mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
[naver] recognize '.naver' URLs
https://blog.naver.com/PostView.naver?…
This commit is contained in:
parent
36fc510d3a
commit
7b28418f69
@ -26,7 +26,8 @@ class NaverPostExtractor(NaverBase, GalleryExtractor):
|
|||||||
"{post[date]:%Y-%m-%d} {post[title]}")
|
"{post[date]:%Y-%m-%d} {post[title]}")
|
||||||
archive_fmt = "{blog[id]}_{post[num]}_{num}"
|
archive_fmt = "{blog[id]}_{post[num]}_{num}"
|
||||||
pattern = (r"(?:https?://)?blog\.naver\.com/"
|
pattern = (r"(?:https?://)?blog\.naver\.com/"
|
||||||
r"(?:PostView\.nhn\?blogId=(\w+)&logNo=(\d+)|(\w+)/(\d+)/?$)")
|
r"(?:PostView\.n(?:aver|hn)\?blogId=(\w+)&logNo=(\d+)|"
|
||||||
|
r"(\w+)/(\d+)/?$)")
|
||||||
example = "https://blog.naver.com/BLOGID/12345"
|
example = "https://blog.naver.com/BLOGID/12345"
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
@ -73,7 +74,8 @@ class NaverBlogExtractor(NaverBase, Extractor):
|
|||||||
subcategory = "blog"
|
subcategory = "blog"
|
||||||
categorytransfer = True
|
categorytransfer = True
|
||||||
pattern = (r"(?:https?://)?blog\.naver\.com/"
|
pattern = (r"(?:https?://)?blog\.naver\.com/"
|
||||||
r"(?:PostList.nhn\?(?:[^&#]+&)*blogId=([^&#]+)|(\w+)/?$)")
|
r"(?:PostList\.n(?:aver|hn)\?(?:[^&#]+&)*blogId=([^&#]+)|"
|
||||||
|
r"(\w+)/?$)")
|
||||||
example = "https://blog.naver.com/BLOGID"
|
example = "https://blog.naver.com/BLOGID"
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
@ -81,12 +83,11 @@ class NaverBlogExtractor(NaverBase, Extractor):
|
|||||||
self.blog_id = match.group(1) or match.group(2)
|
self.blog_id = match.group(1) or match.group(2)
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
|
|
||||||
# fetch first post number
|
# fetch first post number
|
||||||
url = "{}/PostList.nhn?blogId={}".format(self.root, self.blog_id)
|
url = "{}/PostList.nhn?blogId={}".format(self.root, self.blog_id)
|
||||||
post_num = text.extract(
|
post_num = text.extr(
|
||||||
self.request(url).text, 'gnFirstLogNo = "', '"',
|
self.request(url).text, 'gnFirstLogNo = "', '"',
|
||||||
)[0]
|
)
|
||||||
|
|
||||||
# setup params for API calls
|
# setup params for API calls
|
||||||
url = "{}/PostViewBottomTitleListAsync.nhn".format(self.root)
|
url = "{}/PostViewBottomTitleListAsync.nhn".format(self.root)
|
||||||
|
@ -24,6 +24,12 @@ __tests__ = (
|
|||||||
"#sha1_metadata": "a6e23d19afbee86b37d6e7ad934650c379d2cb1e",
|
"#sha1_metadata": "a6e23d19afbee86b37d6e7ad934650c379d2cb1e",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://blog.naver.com/PostView.naver?blogId=rlfqjxm0&logNo=221430673006",
|
||||||
|
"#category": ("", "naver", "post"),
|
||||||
|
"#class" : naver.NaverPostExtractor,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://blog.naver.com/gukjung",
|
"#url" : "https://blog.naver.com/gukjung",
|
||||||
"#category": ("", "naver", "blog"),
|
"#category": ("", "naver", "blog"),
|
||||||
@ -42,4 +48,10 @@ __tests__ = (
|
|||||||
"#count" : 12,
|
"#count" : 12,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://blog.naver.com/PostList.naver?blogId=gukjung",
|
||||||
|
"#category": ("", "naver", "blog"),
|
||||||
|
"#class" : naver.NaverBlogExtractor,
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user