Afreeca plugin not available again #568

Closed
trocknet opened this Issue Oct 16, 2014 · 5 comments

Comments

Projects
None yet
4 participants
@trocknet

Please fix it.

@trocknet

This comment has been minimized.

Show comment
Hide comment
@trocknet

trocknet Oct 16, 2014

m.afreeca.com and it's API are changed.

m.afreeca.com and it's API are changed.

@trocknet

This comment has been minimized.

Show comment
Hide comment
@trocknet

trocknet Oct 17, 2014

It is seems that afreeca has started to provide RTMP stream.
http://play.afreeca.com/sogoodtt

It is seems that afreeca has started to provide RTMP stream.
http://play.afreeca.com/sogoodtt

@VackerSimon

This comment has been minimized.

Show comment
Hide comment
@VackerSimon

VackerSimon Oct 17, 2014

I've investigated a bit and the flash player got these URLs for a stream I tested rtmp://101.79.243.142:1935/hotter2/definst/111640179-flash-hd-rtmp
and
rtmp://112.175.63.14:1935/hotter2/definst/111640179-flash-hd-rtmp
Only the second one worked with that one, I tried another stream and only the first one worked on that (rtmp://183.111.26.18:1935/hotter1/definst/111634541-flash-hd-rtmp).

I've investigated a bit and the flash player got these URLs for a stream I tested rtmp://101.79.243.142:1935/hotter2/definst/111640179-flash-hd-rtmp
and
rtmp://112.175.63.14:1935/hotter2/definst/111640179-flash-hd-rtmp
Only the second one worked with that one, I tried another stream and only the first one worked on that (rtmp://183.111.26.18:1935/hotter1/definst/111634541-flash-hd-rtmp).

@trocknet

This comment has been minimized.

Show comment
Hide comment
@trocknet

trocknet Oct 22, 2014

workround:Use the original way to get broadcast ID.

import re

from livestreamer.plugin import Plugin
from livestreamer.stream import HLSStream
from livestreamer.utils import urlget


USER_AGENT = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
HEADERS = {"User-Agent": USER_AGENT}

PLAYLIST_URL = "http://m.afreeca.com/live/stream/a/hls/broad_no/{0}"
CHANNEL_URL = "http://live.afreeca.com:8079/app/index.cgi"
CHANNEL_REGEX = "http(s)?://(\w+\.)?afreeca.com/(?P<username>\w+)"


class AfreecaTV(Plugin):
    @classmethod
    def can_handle_url(self, url):
        return re.match(CHANNEL_REGEX, url)

    def _find_broadcast(self, username):
        res = urlget(CHANNEL_URL, headers=HEADERS,
                     params=dict(szBjId=username))

        match = re.search(r"<img id=\"broadImg\" src=\".+\/(\d+)\.gif\"",
                          res.text)
        if match:
            return match.group(1)

    def _get_streams(self):
        match = re.match(CHANNEL_REGEX, self.url)
        if not match:
            return

        username = match.group("username")
        broadcast = self._find_broadcast(username)

        if not broadcast:
            return

        stream = HLSStream(self.session, PLAYLIST_URL.format(broadcast), headers=HEADERS)

        return dict(live=stream)

__plugin__ = AfreecaTV

workround:Use the original way to get broadcast ID.

import re

from livestreamer.plugin import Plugin
from livestreamer.stream import HLSStream
from livestreamer.utils import urlget


USER_AGENT = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
HEADERS = {"User-Agent": USER_AGENT}

PLAYLIST_URL = "http://m.afreeca.com/live/stream/a/hls/broad_no/{0}"
CHANNEL_URL = "http://live.afreeca.com:8079/app/index.cgi"
CHANNEL_REGEX = "http(s)?://(\w+\.)?afreeca.com/(?P<username>\w+)"


class AfreecaTV(Plugin):
    @classmethod
    def can_handle_url(self, url):
        return re.match(CHANNEL_REGEX, url)

    def _find_broadcast(self, username):
        res = urlget(CHANNEL_URL, headers=HEADERS,
                     params=dict(szBjId=username))

        match = re.search(r"<img id=\"broadImg\" src=\".+\/(\d+)\.gif\"",
                          res.text)
        if match:
            return match.group(1)

    def _get_streams(self):
        match = re.match(CHANNEL_REGEX, self.url)
        if not match:
            return

        username = match.group("username")
        broadcast = self._find_broadcast(username)

        if not broadcast:
            return

        stream = HLSStream(self.session, PLAYLIST_URL.format(broadcast), headers=HEADERS)

        return dict(live=stream)

__plugin__ = AfreecaTV
@AleXoundOS

This comment has been minimized.

Show comment
Hide comment
@AleXoundOS

AleXoundOS Oct 22, 2014

It works! Thank you!

It works! Thank you!

@chrippa chrippa closed this in 9fce749 Oct 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment