Advertisement
Guest User

Untitled

a guest
Apr 15th, 2024
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. from yt_dlp.extractor.common import InfoExtractor
  2. from datetime import datetime
  3.  
  4. class PomfIE(InfoExtractor):
  5.     _VALID_URL = r'https?://(?:www\.)?pomf\.tv/streamhistory/(?P<uploader>[^/]+)/(?P<id>[0-9]+)'
  6.  
  7.     def _real_extract(self, url):
  8.         match = self._match_valid_url(url)
  9.         video_id = match.group('id')
  10.         uploader = match.group('uploader')
  11.  
  12.         vods = self._download_json(f"https://pomf.tv/api/history/getuserhistory.php?user={uploader}", video_id)
  13.         vod = vods.get(video_id)
  14.         video_url = vod.get('raw_url')
  15.         timestamp = int(datetime.strptime(vod.get('date'), "%Y-%m-%d %H:%M:%S").timestamp())
  16.        
  17.         return {
  18.             'id': video_id,
  19.             'title': vod.get('stream_title'),
  20.             'uploader': uploader,
  21.             'thumbnail': f"https:{video_url}.png",
  22.             'url': f"https:{video_url}",
  23.             'timestamp': timestamp
  24.         }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement