Skip to content

Commit

Permalink
Merge pull request #291 from unintended/patch-1
Browse files Browse the repository at this point in the history
Add playback of first available video on the page
  • Loading branch information
chrippa committed Feb 13, 2014
2 parents 04fb38a + d36c576 commit 1d0b4b7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/livestreamer/plugins/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ def _find_config(self, data):
def _get_stream_info(self, url):
res = urlget(url)
config = self._find_config(res.text)

if not config:
watch_match = re.search("href=\"/(watch\?v=.+?)\"", res.text)
if watch_match:
watch_url = "http://youtube.com/%s" % watch_match.group(1)
res = urlget(watch_url)
config = self._find_config(res.text)

if config:
return parse_json(config, "config JSON")
Expand Down

0 comments on commit 1d0b4b7

Please sign in to comment.