Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Periscope.tv profile processing broken #9563

Closed
RealDolos opened this issue May 21, 2016 · 0 comments
Closed

Periscope.tv profile processing broken #9563

RealDolos opened this issue May 21, 2016 · 0 comments

Comments

@RealDolos
Copy link

@RealDolos RealDolos commented May 21, 2016

  • I've verified and I assure that I'm running youtube-dl 2016.05.16
  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)

STR:

  1. Run youtube-dl on a periscope.tv profile page with archived or live streams such as https://www.periscope.tv/someuser (cannot give working example as streams are only archived 24h and I cannot know when this issue is read)
  2. youtube-dl will report it did not find any videos, although there are some

Expected:

  • youtube-dl will enumerate and download any live and archived broadcasts.

periscope.tv seems to have changed their website, breaking youtube-dl in the process.
While user and broadcast data was previously available from some meta tags, this appears to no longer be the case.
Instead data is available in a huge data-store= attribute on some element.

My "hack it into submission" patch, "I feel unclean now" Edition:

diff --git a/youtube_dl/extractor/periscope.py b/youtube_dl/extractor/periscope.py
index 440fb84..c3bc744 100644
--- a/youtube_dl/extractor/periscope.py
+++ b/youtube_dl/extractor/periscope.py
@@ -111,9 +111,18 @@ class PeriscopeUserIE(InfoExtractor):
             self._html_search_meta('user-broadcasts', webpage, default='{}'),
             user_id)

-        entries = [
+        entries = list(reversed([
             self.url_result(
                 'https://www.periscope.tv/%s/%s' % (user_id, broadcast['id']))
-            for broadcast in user_broadcasts.get('broadcasts', [])]
+            for broadcast in user_broadcasts.get('broadcasts', [])]))
+
+        if not entries:
+            new_data = self._parse_json(self._html_search_regex(
+                r'data-store="(.*?)"', webpage, user_id, default="{}"), user_id)
+            username = new_data.get("User", {}).get("user", {}).get("display_name")
+            broadcasts = new_data.get("UserBroadcastHistory", {}).get("broadcasts", [])
+            entries = list(reversed([
+                self.url_result('https://www.periscope.tv/%s/%s' % (user_id, broadcast['id']))
+                for broadcast in broadcasts]))

         return self.playlist_result(entries, user_id, username)

Not currently in the mood to clean this up and do a PR, maybe later if nobody else (@dstftw ?) does it.

@dstftw dstftw closed this in 0db9a05 May 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.