totalwebcasting.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class TotalWebCastingIE(InfoExtractor):
  4. IE_NAME = 'totalwebcasting.com'
  5. _VALID_URL = r'https?://www\.totalwebcasting\.com/view/\?func=VOFF.*'
  6. _TEST = {
  7. 'url': 'https://www.totalwebcasting.com/view/?func=VOFF&id=columbia&date=2017-01-04&seq=1',
  8. 'info_dict': {
  9. 'id': '270e1c415d443924485f547403180906731570466a42740764673853041316737548',
  10. 'title': 'Real World Cryptography Conference 2017',
  11. 'description': 'md5:47a31e91ed537a2bb0d3a091659dc80c',
  12. },
  13. 'playlist_count': 6,
  14. }
  15. def _real_extract(self, url):
  16. params = url.split('?', 1)[1]
  17. webpage = self._download_webpage(url, params)
  18. aprm = self._search_regex(r"startVideo\('(\w+)'", webpage, 'aprm')
  19. VLEV = self._download_json("https://www.totalwebcasting.com/view/?func=VLEV&aprm=%s&style=G" % aprm, aprm)
  20. parts = []
  21. for s in VLEV["aiTimes"].values():
  22. n = int(s[:-5])
  23. if n == 99:
  24. continue
  25. if n not in parts:
  26. parts.append(n)
  27. parts.sort()
  28. title = VLEV["title"]
  29. entries = []
  30. for p in parts:
  31. VLEV = self._download_json("https://www.totalwebcasting.com/view/?func=VLEV&aprm=%s&style=G&refP=1&nf=%d&time=1&cs=1&ns=1" % (aprm, p), aprm)
  32. for s in VLEV["playerObj"]["clip"]["sources"]:
  33. if s["type"] != "video/mp4":
  34. continue
  35. entries.append({
  36. "id": "%s_part%d" % (aprm, p),
  37. "url": "https:" + s["src"],
  38. "title": title,
  39. })
  40. return {
  41. '_type': 'multi_video',
  42. 'id': aprm,
  43. 'entries': entries,
  44. 'title': title,
  45. 'description': VLEV.get("desc"),
  46. }