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

[chaturbate] fix url extraction and parsing #23012

Closed
wants to merge 1 commit into from
Closed

[chaturbate] fix url extraction and parsing #23012

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 8, 2019

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

Fixes issue #23010

The chaturbate extractor broke some time this evening. The regex looking for .m3u8 URLs no longer matched anything. Additionally, the URL now needs a bit of extra processing.

The page source contains a large JavaScript string containing an encoded JSON object. The nested quotes, as well as other special characters, are encoded as e.g. \u0022. So, we match the URL delimited by \u0022 or \u0027 (double or single quotes, respectively) and then decode any \uXXXX sequences in the match group.

@ghost ghost mentioned this pull request Nov 8, 2019
9 tasks
@ghost
Copy link

ghost commented Nov 9, 2019

Noob here, how do I implement these changes?

@ghost
Copy link
Author

ghost commented Nov 10, 2019

@Ubernoob7 Here's one way to do it:

  1. Download my fork: https://github.com/throwaway396/youtube-dl/archive/master.zip
  2. Extract it somewhere convenient
  3. Open a terminal (command prompt) in the youtube-dl-master folder you just extracted
  4. Run python youtube_dl/__main__.py "https://chaturbate.com/model/"

I'm assuming you already have Python installed and in your PATH.

@casualreader
Copy link

A simple interim fix: inserting a cookie "cb_legacy=1" reverts to the old behaviour.

*** youtube_dl/extractor/chaturbate.py.orig
--- youtube_dl/extractor/chaturbate.py


*** 31,37 ****
def _real_extract(self, url):
video_id = self._match_id(url)

! webpage = self._download_webpage(url, video_id)

      m3u8_urls = []

--- 31,39 ----
def _real_extract(self, url):
video_id = self._match_id(url)

! webpage = self._download_webpage(url, video_id, headers={
! 'Cookie': 'cb_legacy=1',
! })

      m3u8_urls = []

youtube-dl.patch.txt

@pcjamesy
Copy link

Question for you, I have a crontab and a run-one system to automagiclly record streams when they go live, or come back from one of the private modes. The script it as follows "run-one youtube-dl -o '/home/ubuntu/video/%(title)s.%(ext)s' https://chaturbate.com/URL/"

How would I take your branch that i've installed and make it run from anyfolder when "youtube-dl" is called?

@purrsevere
Copy link

@pcjamesy Install it globally.

git clone https://github.com/throwaway396/youtube-dl /tmp/youtube-dl
cd /tmp/youtube-dl 
python3 setup.py install

@CashMoney6980
Copy link

@pcjamesy Install it globally.

git clone https://github.com/throwaway396/youtube-dl /tmp/youtube-dl
cd /tmp/youtube-dl 
python3 setup.py install

This worked for me! Many thanks!

@Alex999Rus
Copy link

guys who can record a video for me how to fix it on windows 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants