mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-12-04 06:17:54 +01:00
made regex more robust, fixed coding conventions
This commit is contained in:
parent
9ccab97034
commit
efae7c1a5d
@ -4,7 +4,6 @@ from __future__ import unicode_literals
|
|||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
import datetime
|
|
||||||
|
|
||||||
from .common import InfoExtractor, SearchInfoExtractor
|
from .common import InfoExtractor, SearchInfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
@ -471,11 +470,13 @@ class NiconicoPlaylistIE(InfoExtractor):
|
|||||||
'entries': entries,
|
'entries': entries,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# USAGE: youtube-dl "nicosearch<NUMBER OF ENTRIES>:<SEARCH STRING>"
|
# USAGE: youtube-dl "nicosearch<NUMBER OF ENTRIES>:<SEARCH STRING>"
|
||||||
class NicovideoIE(SearchInfoExtractor):
|
class NicovideoIE(SearchInfoExtractor):
|
||||||
IE_DESC = 'Nico video search'
|
IE_DESC = 'Nico video search'
|
||||||
_MAX_RESULTS = 100000
|
_MAX_RESULTS = 100000
|
||||||
_SEARCH_KEY = 'nicosearch'
|
_SEARCH_KEY = 'nicosearch'
|
||||||
|
|
||||||
def _get_n_results(self, query, n):
|
def _get_n_results(self, query, n):
|
||||||
"""Get a specified number of results for a query"""
|
"""Get a specified number of results for a query"""
|
||||||
entries = []
|
entries = []
|
||||||
@ -507,7 +508,7 @@ class NicovideoIE(SearchInfoExtractor):
|
|||||||
link = url + "&page=" + str(pageNumber) + "&start=" + str(date) + "&end=" + str(date)
|
link = url + "&page=" + str(pageNumber) + "&start=" + str(date) + "&end=" + str(date)
|
||||||
results = self._download_webpage(link, query, note='Downloading results page %s for date %s' % (pageNumber, date))
|
results = self._download_webpage(link, query, note='Downloading results page %s for date %s' % (pageNumber, date))
|
||||||
entries = []
|
entries = []
|
||||||
r = re.findall(r'<a href="/watch/(..[0-9]{1,8})\?', results)
|
r = re.findall(r'''<li.*(?!</li>) data-video-id=['|"](..[0-9]{1,8})''', results)
|
||||||
|
|
||||||
for item in r:
|
for item in r:
|
||||||
e = self.url_result("http://www.nicovideo.jp/watch/" + str(item), 'Niconico')
|
e = self.url_result("http://www.nicovideo.jp/watch/" + str(item), 'Niconico')
|
||||||
|
Loading…
Reference in New Issue
Block a user