mirror of https://github.com/streamlink/streamlink
plugins.afreeca: use Referer for every connection (#2204)
* plugins.afreeca: use Referer for every connection * plugins.afreeca: removed old domains that won't work with the plugin
This commit is contained in:
parent
3946184ab4
commit
ee81d1a0a2
|
@ -15,8 +15,7 @@ Name URL(s) Live VOD Notes
|
|||
abematv abema.tv Yes Yes Streams are geo-restricted to Japan.
|
||||
abweb abweb.com Yes No Requires a login and a subscription.
|
||||
adultswim adultswim.com Yes Yes Streams may be geo-restricted, some VOD streams are protected by DRM.
|
||||
afreeca - afreecatv.com Yes No
|
||||
- afreeca.tv
|
||||
afreeca play.afreecatv.com Yes No
|
||||
aljazeeraen aljazeera.com Yes Yes English version of the site.
|
||||
animelab animelab.com -- Yes Requires a login. Streams may be geo-restricted to Australia and New Zealand.
|
||||
app17 17app.co Yes --
|
||||
|
|
|
@ -19,7 +19,7 @@ QUALITY_WEIGHTS = {
|
|||
"sd": 480
|
||||
}
|
||||
|
||||
_url_re = re.compile(r"http(s)?://(?P<cdn>\w+\.)?afreeca(tv)?\.com/(?P<username>\w+)(/\d+)?")
|
||||
_url_re = re.compile(r"https?://play\.afreecatv\.com/(?P<username>\w+)(?:/\d+)?")
|
||||
|
||||
_channel_schema = validate.Schema(
|
||||
{
|
||||
|
@ -86,10 +86,6 @@ class AfreecaTV(Plugin):
|
|||
return self.session.http.json(res, schema=_channel_schema)
|
||||
|
||||
def _get_hls_key(self, broadcast, username, quality):
|
||||
headers = {
|
||||
"Referer": self.url
|
||||
}
|
||||
|
||||
data = {
|
||||
"bid": username,
|
||||
"bno": broadcast,
|
||||
|
@ -97,7 +93,7 @@ class AfreecaTV(Plugin):
|
|||
"quality": quality,
|
||||
"type": "pwd"
|
||||
}
|
||||
res = self.session.http.post(CHANNEL_API_URL, data=data, headers=headers)
|
||||
res = self.session.http.post(CHANNEL_API_URL, data=data)
|
||||
return self.session.http.json(res, schema=_channel_schema)
|
||||
|
||||
def _get_stream_info(self, broadcast, quality, cdn, rmd):
|
||||
|
@ -139,6 +135,7 @@ class AfreecaTV(Plugin):
|
|||
return False
|
||||
|
||||
def _get_streams(self):
|
||||
self.session.http.headers.update({"Referer": self.url})
|
||||
if not self.session.get_option("hls-segment-ignore-names"):
|
||||
ignore_segment = ["preloading"]
|
||||
self.session.set_option("hls-segment-ignore-names", ignore_segment)
|
||||
|
|
|
@ -6,15 +6,18 @@ from streamlink.plugins.afreeca import AfreecaTV
|
|||
class TestPluginAfreecaTV(unittest.TestCase):
|
||||
def test_can_handle_url(self):
|
||||
should_match = [
|
||||
"http://afreecatv.com/exampleuser",
|
||||
"http://afreecatv.com/exampleuser/123123123",
|
||||
"http://play.afreecatv.com/exampleuser",
|
||||
"http://play.afreecatv.com/exampleuser/123123123",
|
||||
"https://play.afreecatv.com/exampleuser",
|
||||
]
|
||||
for url in should_match:
|
||||
self.assertTrue(AfreecaTV.can_handle_url(url))
|
||||
|
||||
should_not_match = [
|
||||
"http://afreeca.com/exampleuser",
|
||||
"http://afreeca.com/exampleuser/123123123",
|
||||
"http://afreecatv.com/exampleuser",
|
||||
"http://afreecatv.com/exampleuser/123123123",
|
||||
"http://www.afreecatv.com.tw",
|
||||
"http://www.afreecatv.jp",
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue