-
-
Save seventhmoon/9ac378c006d6c9a0b944 to your computer and use it in GitHub Desktop.
import java.io.IOException; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
import java.util.Map; | |
public class Helper { | |
public enum Channel {HDJ, J2, INEWS}; | |
public enum Quality {QUALITY_720P, QUALITY_360P}; | |
private static String[] links720p = {"http://token.tvb.com/stream/live/hls/mobilehd_hdj.smil", | |
"http://token.tvb.com/stream/live/hls/mobilehd_jade.smil", | |
"http://token.tvb.com/stream/live/hls/mobilehd_j2.smil", | |
"http://token.tvb.com/stream/live/hls/mobilehd_inews.smil"}; | |
private static String[] links360p = {"http://token.tvb.com/stream/live/hls/mobile_hdj.smil", | |
"http://token.tvb.com/stream/live/hls/mobile_jade.smil", | |
"http://token.tvb.com/stream/live/hls/mobile_j2.smil", | |
"http://token.tvb.com/stream/live/hls/mobile_inews.smil"}; | |
public static String getPlaylist(Channel channel, Quality quality) { | |
try { | |
String[] links; | |
String link = null; | |
if (quality == Quality.QUALITY_720P){ | |
links = links720p; | |
}else { | |
links = links360p; | |
} | |
switch (channel) { | |
case HDJ: | |
link = links[0]; | |
break; | |
case J2: | |
link = links[1]; | |
break; | |
case INEWS: | |
link = links[2]; | |
break; | |
} | |
URL url = new URL(link); | |
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | |
conn.setInstanceFollowRedirects(false); | |
int code = conn.getResponseCode(); | |
Map map = conn.getHeaderFields(); | |
if (code == 302) { | |
return map.get("Location").toString().replaceAll("\\[", "").replaceAll("\\]", ""); | |
} else { | |
return link; | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
return null; | |
} | |
} |
Actually i use hongkong vpn to access the token link.....but it does not goes to the ip link that you mention. which is why i am wondering how you get the ip address link
http://token.tvb.com/stream/live/hls/mobilehd_jade.smil?app=mytv
HTTP ERROR 403 now :(
Are the links deleted? There's no vital sign!
.......
TVB fix GOTV and MYTVSUPER.
GOTV and MYTVSUPER fix
So I had some time to investigate this again. Funnily enough, if you can trick the myTV app into thinking it's inside HK (by returning a modified JSON response for example), you can still use the app like normal for live tv.
Accessing the URL stream itself isn't as simple as just loading it up now though, the way the app works is that it'll load up the URL like so:
http://token.tvb.com/stream/live/hls/mobilehd_jade.smil?time=*current epoch time in milliseconds*&app=mytv4
The time parameter is required, the app parameter however can be omitted but what the app will also send is a certain request header like so:
Key: t
Value: eeeeb6ee6a25e9ef0fa17e27fe39f7ee0a917d0d761688c83d840b52cfc7fc8e
Supply a valid t request header and the stream link is usable outside the app. Unfortunately I'm not sure how the value's generated so once I get more time, I can research further into that matter.
EDIT: Further examination with the app seems to suggest that the time in milliseconds is encrypted to provide the value for 't'. The encryption method is hidden behind a shared object library so I can't find out how it's getting encrypted without performing disassembly on the file. Judging from the values I've seen over repeated requests, it may seem like two MD5 hashes contatenated with each other.
有大神还能下载mytvsuper和gotv吗
Help me~HTTP ERROR 403
super download
yes all links are broken, is there any solution to download from mytvsuper?
@shawn35
I can only speak from experience. When I am not in Hong Kong, and I connect to
http://token.tvb.com/stream/live/hls/mobilehd_jade.smil?app=mytv
without a proxy/VPN or a smart DNS service, that link above will resolve to a similar link like what you have highlighted.
http://vdo-live-cache-akamai.cdn.tvb.com/mytvlive/smil:mobilehd_hdj.smil/chunklist_b1536000.m3u8?xxxxxxxxx
I cannot tell beyond what I don't know about. It's probably geo-location locked.