Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
ytdl-patched
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lesmiscore
ytdl-patched
Commits
c66ed4e2
Unverified
Commit
c66ed4e2
authored
2 years ago
by
bashonly
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[extractor/americastestkitchen] Fix extractor (#5343)
Fix `_VALID_URL` and season extraction Closes #5343 Authored by: bashonly
parent
2530b68d
No related branches found
Branches containing commit
Tags
1639276434
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
yt_dlp/extractor/americastestkitchen.py
+32
-22
32 additions, 22 deletions
yt_dlp/extractor/americastestkitchen.py
with
32 additions
and
22 deletions
yt_dlp/extractor/americastestkitchen.py
+
32
−
22
View file @
c66ed4e2
...
...
@@ -11,7 +11,7 @@
class
AmericasTestKitchenIE
(
InfoExtractor
):
_VALID_URL
=
r
'
https?://(?:www\.)?
(?:
americastestkitchen
|
cooks(?:country|illustrated)
)\.com/
(?P<resource_type>episode|videos)/(?P<id>\d+)
'
_VALID_URL
=
r
'
https?://(?:www\.)?americastestkitchen
\.com/(?:
cooks(?:country|illustrated)
/)?
(?P<resource_type>episode|videos)/(?P<id>\d+)
'
_TESTS
=
[{
'
url
'
:
'
https://www.americastestkitchen.com/episode/582-weeknight-japanese-suppers
'
,
'
md5
'
:
'
b861c3e365ac38ad319cfd509c30577f
'
,
...
...
@@ -19,15 +19,20 @@ class AmericasTestKitchenIE(InfoExtractor):
'
id
'
:
'
5b400b9ee338f922cb06450c
'
,
'
title
'
:
'
Japanese Suppers
'
,
'
ext
'
:
'
mp4
'
,
'
display_id
'
:
'
weeknight-japanese-suppers
'
,
'
description
'
:
'
md5:64e606bfee910627efc4b5f050de92b3
'
,
'
thumbnail
'
:
r
'
re:^https?://
'
,
'
timestamp
'
:
1523318400
,
'
upload_date
'
:
'
20180410
'
,
'
release_date
'
:
'
20180410
'
,
'
series
'
:
"
America
'
s Test Kitchen
"
,
'
season_number
'
:
18
,
'
timestamp
'
:
1523304000
,
'
upload_date
'
:
'
20180409
'
,
'
release_date
'
:
'
20180409
'
,
'
series
'
:
'
America
\'
s Test Kitchen
'
,
'
season
'
:
'
Season 18
'
,
'
episode
'
:
'
Japanese Suppers
'
,
'
season_number
'
:
18
,
'
episode_number
'
:
15
,
'
duration
'
:
1376
,
'
thumbnail
'
:
r
'
re:^https?://
'
,
'
average_rating
'
:
0
,
'
view_count
'
:
int
,
},
'
params
'
:
{
'
skip_download
'
:
True
,
...
...
@@ -40,15 +45,20 @@ class AmericasTestKitchenIE(InfoExtractor):
'
id
'
:
'
5fbe8c61bda2010001c6763b
'
,
'
title
'
:
'
Simple Chicken Dinner
'
,
'
ext
'
:
'
mp4
'
,
'
display_id
'
:
'
atktv_2103_simple-chicken-dinner_full-episode_web-mp4
'
,
'
description
'
:
'
md5:eb68737cc2fd4c26ca7db30139d109e7
'
,
'
thumbnail
'
:
r
'
re:^https?://
'
,
'
timestamp
'
:
1610755200
,
'
upload_date
'
:
'
20210116
'
,
'
release_date
'
:
'
20210116
'
,
'
series
'
:
"
America
'
s Test Kitchen
"
,
'
season_number
'
:
21
,
'
timestamp
'
:
1610737200
,
'
upload_date
'
:
'
20210115
'
,
'
release_date
'
:
'
20210115
'
,
'
series
'
:
'
America
\'
s Test Kitchen
'
,
'
season
'
:
'
Season 21
'
,
'
episode
'
:
'
Simple Chicken Dinner
'
,
'
season_number
'
:
21
,
'
episode_number
'
:
3
,
'
duration
'
:
1397
,
'
thumbnail
'
:
r
'
re:^https?://
'
,
'
view_count
'
:
int
,
'
average_rating
'
:
0
,
},
'
params
'
:
{
'
skip_download
'
:
True
,
...
...
@@ -57,10 +67,10 @@ class AmericasTestKitchenIE(InfoExtractor):
'
url
'
:
'
https://www.americastestkitchen.com/videos/3420-pan-seared-salmon
'
,
'
only_matching
'
:
True
,
},
{
'
url
'
:
'
https://www.cookscountry
.com
/episode/564-when-only-chocolate-will-do
'
,
'
url
'
:
'
https://www.
americastestkitchen.com/
cookscountry/episode/564-when-only-chocolate-will-do
'
,
'
only_matching
'
:
True
,
},
{
'
url
'
:
'
https://www.cooksillustrated
.com
/videos/4478-beef-wellington
'
,
'
url
'
:
'
https://www.
americastestkitchen.com/
cooksillustrated/videos/4478-beef-wellington
'
,
'
only_matching
'
:
True
,
}]
...
...
@@ -90,7 +100,7 @@ def _real_extract(self, url):
class
AmericasTestKitchenSeasonIE
(
InfoExtractor
):
_VALID_URL
=
r
'
https?://(?:www\.)?
(?P<show>
americastestkitchen
|
cookscountry)
\.com
/episodes/browse/season_(?P<id>\d+)
'
_VALID_URL
=
r
'
https?://(?:www\.)?americastestkitchen
\.com(?P<show>/
cookscountry)
?
/episodes/browse/season_(?P<id>\d+)
'
_TESTS
=
[{
# ATK Season
'
url
'
:
'
https://www.americastestkitchen.com/episodes/browse/season_1
'
,
...
...
@@ -101,7 +111,7 @@ class AmericasTestKitchenSeasonIE(InfoExtractor):
'
playlist_count
'
:
13
,
},
{
# Cooks Country Season
'
url
'
:
'
https://www.cookscountry
.com
/episodes/browse/season_12
'
,
'
url
'
:
'
https://www.
americastestkitchen.com/
cookscountry/episodes/browse/season_12
'
,
'
info_dict
'
:
{
'
id
'
:
'
season_12
'
,
'
title
'
:
'
Season 12
'
,
...
...
@@ -110,17 +120,17 @@ class AmericasTestKitchenSeasonIE(InfoExtractor):
}]
def
_real_extract
(
self
,
url
):
show_
name
,
season_number
=
self
.
_match_valid_url
(
url
).
group
s
()
show_
path
,
season_number
=
self
.
_match_valid_url
(
url
).
group
(
'
show
'
,
'
id
'
)
season_number
=
int
(
season_number
)
slug
=
'
atk
'
if
show_
name
==
'
americastestkitchen
'
else
'
cco
'
slug
=
'
cco
'
if
show_
path
==
'
/cookscountry
'
else
'
atk
'
season
=
'
Season %d
'
%
season_number
season_search
=
self
.
_download_json
(
'
https://y1fnzxui30-dsn.algolia.net/1/indexes/everest_search_%s_season_desc_production
'
%
slug
,
season
,
headers
=
{
'
Origin
'
:
'
https://www.
%s.com
'
%
show_name
,
'
Origin
'
:
'
https://www.
americastestkitchen.com
'
,
'
X-Algolia-API-Key
'
:
'
8d504d0099ed27c1b73708d22871d805
'
,
'
X-Algolia-Application-Id
'
:
'
Y1FNZXUI30
'
,
},
query
=
{
...
...
@@ -136,12 +146,12 @@ def _real_extract(self, url):
def
entries
():
for
episode
in
(
season_search
.
get
(
'
hits
'
)
or
[]):
search_url
=
episode
.
get
(
'
search_url
'
)
search_url
=
episode
.
get
(
'
search_url
'
)
# always formatted like '/episode/123-title-of-episode'
if
not
search_url
:
continue
yield
{
'
_type
'
:
'
url
'
,
'
url
'
:
'
https://www.
%s.com%s
'
%
(
show_name
,
search_url
)
,
'
url
'
:
f
'
https://www.
americastestkitchen.com
{
show_path
or
""
}{
search_url
}
'
,
'
id
'
:
try_get
(
episode
,
lambda
e
:
e
[
'
objectID
'
].
split
(
'
_
'
)[
-
1
]),
'
title
'
:
episode
.
get
(
'
title
'
),
'
description
'
:
episode
.
get
(
'
description
'
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment