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

[ie/thisoldhouse] Add login support #8561

Merged
merged 9 commits into from
Nov 11, 2023
Merged

Conversation

bashonly
Copy link
Member

@bashonly bashonly commented Nov 10, 2023

The site apparently uses session cookies now, so a credentialed login method was needed. And per the linked issue, the extractor also wasn't always resolving the Zype URL when the video required auth (the auth token is granted/passed in the query of the resolved URL), so that was fixed also

Closes #8257

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • 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?

Copilot Summary

🤖 Generated by Copilot at 53ea4f8

Summary

🔐🛠️🧹

Enhance thisoldhouse.py extractor with login and error handling features. Fix and clean up tests. Refactor video extraction code.

Sing, O Muse, of the skillful coder who devised
A way to log in and watch the videos of This Old House,
The ancient show that teaches mortals how to build and renovate
With wisdom and with craft, like Hephaestus in his forge.

Walkthrough

  • Add login support and error handling for This Old House extractor (_perform_login, link, link)
  • Import urljoin, urlparse, compat_parse_qs, ExtractorError, and expected_status from utils module (link)
  • Set _NETRC_MACHINE attribute to thisoldhouse to enable netrc credentials (link)
  • Define _perform_login method that performs multiple requests and form submissions to log in to the site (link)
  • Check for login required message in _real_extract and call _perform_login if needed (link)
  • Simplify extraction of video URL and ID by using a single regex with groups (r'<iframe[^>]+src="([^"]+zype\.com/([^/]+)/embed[^"]*)"') (link)
  • Resolve Zype URL by making a HEAD request and following the Location header (link)
  • Raise ExtractorError if login fails or Zype URL is invalid (link)
  • Update test URLs and comments for unavailable or moved videos (link)
    • Change test URL for how-to-build-a-storage-bench video to /watch/how-to-build-a-storage-bench/ (link)
    • Change test URL for how-to-build-a-raised-vegetable-garden video to /watch/how-to-build-a-raised-vegetable-garden/ and add comment that it is only matching due to geo-restriction (link)
    • Remove test URL for how-to-build-a-picnic-table video and add comment that it is no longer available (link)

@bashonly bashonly added site-enhancement Feature request for some website site-bug Issue with a specific website labels Nov 10, 2023
@bashonly bashonly mentioned this pull request Nov 10, 2023
11 tasks
@bashonly bashonly self-assigned this Nov 11, 2023
@bashonly bashonly merged commit c76c966 into yt-dlp:master Nov 11, 2023
16 checks passed
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
@bashonly bashonly deleted the fix/thisoldhouse branch May 10, 2024 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-bug Issue with a specific website site-enhancement Feature request for some website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

This Old House (Insider)
2 participants