blackjack4494 / yt-dlc

media downloader and library for various sites.
The Unlicense
2.91k stars 368 forks source link

Please fix auto login for Comcast/Xfinity users #22

Closed tv21 closed 4 years ago

tv21 commented 4 years ago

The issue is that if you are an Xfinity customer and you try to use youtube-dl while on your home Xfinity connection (in other words you are not trying to log in through some other ISP) it will not allow you to login unless it completes its auto-login sequence. This 8 line fix allows that and has worked fine for a year and a half now, it was originally posted in a comment on a related issue on the other site, but for some inexplicable reason was never added to the main program. This is the output of the diff command comparing the original adobepass.py to the patched one, as you can see there are only 8 lines to be added (6 if you don't count the comments):

$ diff -u adobepass.py.original adobepass.py.patched
--- adobepass.py.original   2018-10-17 01:22:56.000000000 -0400
+++ adobepass.py.patched    2019-04-23 08:53:36.000000000 -0400
@@ -1433,6 +1433,14 @@
                             provider_redirect_page, 'oauth redirect')
                         self._download_webpage(
                             oauth_redirect_url, video_id, 'Confirming auto login')
+                    elif 'automatically signed in with' in provider_redirect_page:
+                        # Seems like comcast is rolling up new way of automatically signing customers
+                        oauth_redirect_url = self._html_search_regex(
+                            r'continue:\s*"(https://oauth.xfinity.com/oauth/authorize\?.+)"',
+                            provider_redirect_page, 'oauth redirect (signed)')
+                        # Just need to process the request. No useful data comes back
+                        self._download_webpage(
+                            oauth_redirect_url, video_id, 'Confirming auto login')
                     else:
                         if '<form name="signin"' in provider_redirect_page:
                             provider_login_page_res = provider_redirect_page_res

I should clarify that I did not write this patch, just copied it from a comment/submission on the original project.

merval commented 4 years ago

Oh! Is this the patch that was never merged into the original? That PR seemed to be open forever. I got tired of waiting and manually changed mine and built it.

I'm at work right now, but I'll check this out later. I never did understand why it was never merged into the original.

tv21 commented 4 years ago

Yes it is, and I also have no idea why they just kept ignoring it because it has worked great if you know how to patch it yourself.

merval commented 4 years ago

Do you have an example URL I can confirm with? I looked around trying to find one I knew wouldn't work and I couldn't find one.

Mr-Jake commented 4 years ago

I could never get Comcast login to work with Discovery Channel sites. Cookies work but they expire after a half hour.

Example URL: https://go.discovery.com/tv-shows/dino-hunters/full-episodes/nano-or-t-rex

sufr3ak commented 4 years ago

There were numerous issues posted about this on both this and the official repo before they got yanked. Thank you for putting this up. I cannot wait for adobepass to work again

merval commented 4 years ago

Sorry for the late reply, the reason Adobe Pass doesn't for for Discovery is because the discovery extractor code has no mention of the adobe pass code. I'm pretty busy with life and work, but I'll plug away at trying to get this working.

sufr3ak commented 4 years ago

Is there a pull request for this? I'm not a python coder, so I can't assist on this one

merval commented 4 years ago

Is there a pull request for this? I'm not a python coder, so I can't assist on this one

I'll get a PR for this, I was looking to fix Discovery as well, but it looks like it'll be a bit of an overhaul since the way it's written is pretty heavily dependent upon cookies.

As it sits, Only a handful of extractors make use of the ap-mso flag. Discovery would likely need a bit of a rewrite to correctly leverage the authentication method, and not just cookies.

sufr3ak commented 4 years ago

I'm curious if @merval knows why this may fail off network.