Can not Download video from youtube - android

I am using http://www.youtube.com/get_video_info?video_id=*VIDEO_ID* and from the data I get I am parsing the url_encoded_fmt_stream_map and I get the urls like
http://blah.youtube.com/videoplayback?blah
Earlier I could download the videos using this url but now I am not able to download the videos anymore. Anyone has a clue why?

Here is the code to return the video urls:
all credits to youtube-dl I only copied the part of their script which you need for extracting the urls
video_id = "yourvideoid"
for el_type in ['&el=embedded', '&el=detailpage', '&el=vevo', '']:
video_info_url = ('http://www.youtube.com/get_video_info?&video_id=%s%s& ps=default&eurl=&gl=US&hl=en'
% (video_id, el_type))
request = urllib2.Request(video_info_url)
try:
video_info_webpage = urllib2.urlopen(request).read()
video_info = parse_qs(video_info_webpage)
if 'token' in video_info:
break
except (urllib2.URLError, httplib.HTTPException, socket.error), err:
print('ERROR: unable to download video info webpage: %s' % str(err))
video_url_list = video_info['url_encoded_fmt_stream_map'][0]
url_data_strs = video_info['url_encoded_fmt_stream_map'][0].split(',')
url_data = [parse_qs(uds) for uds in url_data_strs]
url_data = filter(lambda ud: 'itag' in ud and 'url' in ud, url_data)
url_map = dict((ud['itag'][0], ud['url'][0] + '&signature=' + ud['sig'][0]) for ud in url_data)
print(str(url_map))

No clue as to why, but it seems to be affecting all downloader extensions, so it's almost certainly on YouTube's side. I'm assuming it has something to do with intellectual property. YouTube is "intended" to be a streaming site, not a video file repository.
Shutaro at addons.mozilla.com has discovered a workaround that entails forcing YouTube to revert to delivering the older .webm format.

I am having the same problem and from what I understand from someone else who has fixed it that we need to add a signature to the video link (the mp4 or 3gp links that are returned)... I'm looking into this and will update. I hope you can do the same if you discover anything.

Related

How To play a video stream from exoplayer?

Hello i have problem i want to play video stream from url link but i have some issue after i use complete url link or without blank space exoplayer player library can detected but after i use file url link blank space cannot detected
example
http://www.something.com/folder/hmmm.mp4 //worked success
after i use this
http://www.something.com/folder/hmmm iknow this blank space.mp4// cannot worked
can someone helpme please thanks
I am gonna answer using the code I used to play video at a URL in exoplayer--
String videoURL="https://d17h27t6h515a5.cloudfront.net/topher/2017/April/58ffdcc8_5-mix-wet-and-cry-batter-together-brownies/5-mix-wet-and-cry-batter-together-brownies.mp4" ;
MediaSource mediaSource = ExtractorMediaSource.Factory(new DefaultHttpDataSourceFactory("exoplayer-codelab"))
.createMediaSource(Uri.parse(videoURL));
So you'll have to give the entire address of video along with video type extension to run successfully.

vimeo video play in Android native

I am developing vimeo video app in native android. But it is not supported in VideoView. May I know any samples or related query for Android. I want final output to be in .mp3/.mp4 format.
I have tried iframe in Android WebView, It works well in Android WebView but I am not able to get seek bar. And OnPause() not able to Pause the video.
Here I am able to get Pause and Play button Only
Example: player.vimeo.com/video/49462103
I want play this video in android native
<VideoView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/videoView"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
Update link in :
Vimeo site Thread-1
Vimeo site Thread-2
I am getting above error
I made a native player for vimeo, base by WebView. Support public and private video.
Try it : https://github.com/ct7ct7ct7/Android-VimeoPlayer
<com.ct7ct7ct7.androidvimeoplayer.view.VimeoPlayerView
android:id="#+id/vimeoPlayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
VimeoPlayerView vimeoPlayer = findViewById(R.id.vimeoPlayer);
getLifecycle().addObserver(vimeoPlayer);
//public video
vimeoPlayer.initialize(59777392);
//If video is open. but limit playing at embedded.
vimeoPlayer.initialize({YourPrivateVideoId}, "SettingsEmbeddedUrl")
//If video is pirvate.
vimeoPlayer.initialize({YourPrivateVideoId},"VideoHashKey", "SettingsEmbeddedUrl")
Vimeo's embed codes should work inside an Android WebView.
Vimeo only offers .mp4 links to PRO users on those users own videos.
Another option is to use the official Deep Link library for the android application. This will let you open any vimeo video in the Android app.
You can use Exoplayer to play vimeo Videos. Exoplayer is more customizable. All you need is to extract the url link from the video config link. You may use retrofit to extract the video url.
BASE_URL = "https://player.vimeo.com/video/"
You will need to use a get method like below:
#GET("{id}/{config}")
Call<JsonObject>getVideoLink(#Path("id") String id, #Path("config") String config);
You will get the id from video link. Example: "https://vimeo.com/123456789/" Here the id is: 123456789 .
JsonObject jsonObject = response.body();
JsonObject req = jsonObject.getAsJsonObject("request");
JsonObject file = req.getAsJsonObject("files");
JsonArray arr = file.getAsJsonArray("progressive");
String url = arr.get(0).getAsJsonObject().get("url").getAsString();
// Build the media item.
MediaItem mediaItem = MediaItem.fromUri(url);
// Set the media item to be played.
player.setMediaItem(mediaItem);
// Prepare the player.
player.prepare();
// Start the playback.
player.play();
Don't forget to initiate Exoplayer first.

Fetching YouTube video list in Titanium

I am newbie in Titanium and trying to fetch video lists of a particular channel from YouTube using THIS tutorial.
The problem is, all time i get "No videos were found for this search" message(used inside catch exception) and from Chrome console i get the exception message:
"No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin localhost:8020 is therefore not allowed access. Failed to load resource: the server responded with a status of 503 (Service Unavailable)"
Can anyone point me out what solution would be for this problem? From some googling, i see that is not the problem inside the code, it's a server-side problem, so how can i overcome this YouTube response problem?
And i also checked that, this line var doc = this.responseXML.documentElement; always results to null that's what no videos are found. I used instead:
if (!this.responseXML)
{
//if not XML you have to convert it to XML
doc = Titanium.XML.parseString(this.responseText).documentElement;
}
else
{
//if it is XML, then just set the doc variable
doc = this.responseXML.documentElement;
}
Still doc is null alltime! Thanks in advance for any suggestion.
Well, i solved the problem. In fact that was a browser issue, when i tested in desktop, browser uses localhost:8020 as the address and YouTube didn't response back for that address.
Later, i tested it a real android device and voila!, it works..var doc = this.responseXML.documentElementclearly contains the responseXML and then it extract video information by var items = doc.getElementsByTagName("entry").
Hope that could help someone someday!

Sorry, this video is not valid for streaming to this device in Http streaming android

I can stream some videos from URL (server) successfully,
But the others (my video up to my server) is not.
You can see both in my code (Working/Not working)
I'm on stuck with this problem.
"Sorry, this video is not valid for streaming to this device"
The following code :
String url = null;
// url = "rtsp://v5.cache5.c.youtube.com/CiILENy73wIaGQmC00ZlwwIDOxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"; // Working
// url = "http://daily3gp.com/vids/747.3gp"; // Working
url = "http://www.ooklnet.com/files/381/381489/video.mp4"; // Working
// url = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov"; // Working
// url = "http://dl.dropbox.com/u/80419/santa.mp4"; // Working
// url = "http://trekvn.hostoi.com/encode_normal.mp4"; // Not Working
// url = "http://trekvn.hostoi.com/output_encode_mp4_box.mp4"; // Not Working
// url = "http://www.ourserversite.com:14556/ingCloud/users/400010001/mp4_320p/e8d8535852a98c949640c5d618ac23d320131022174507.mp4"; // Not Working
// url = "http://trekvn.hostoi.com/mpeg_2_ts.ts"; // Not Working
videoviewer.setVideoURI(Uri.parse(url));
videoviewer.requestFocus();
videoviewer.setKeepScreenOn(true);
videoviewer.setOnErrorListener(this);
videoviewer.setOnPreparedListener(this);
#Override
public void onPrepared(MediaPlayer mp) {
videoviewer.start()'
}
All of these video can play good on the site,
have format *.mp4 (mpeg-4 part 10), Video : .H264, Audio : aac.
Please tell me why,
and how to fix it.
p/s : Samsung Galaxy Tab 7" - 2.2.1
Thanks,
This is the issue that many people met, ensure you understand following content to fix the issue.
Through my experience and the answer in this Sorry, this video cannot be played - streaming mp4 to android
Finally, I found the reason and the solution:
- Reason : Almost the *.mp4 file was produced for developing focus on iOS, and have the encoding : H264 Main. While Android side can only stream & play the files have the encoding : H264 Baseline.
- Solution : We need convert from the encoding H264 Main to H264 Baseline (guaranteed enabled Web Optimized (move -moov atom before -mdat) feature)
- Bugs :
Sorry this video is not valid for streaming to this device.
Sorry, this video can not be played.
HandBrake tool is the easiest and cheapest way to complete it.
Thanks,
p/s : But if you use this method, you need upload your video to the server for testing.

Downloading just the icon of an application from Google Play (Market)

Is there a way to download just the icons that are stored in a particular application from Google Play/Market without downloading the entire APK and installing it?
You can do this but it would require downloading he page source and then parsing it.
What you could do is first download the webpage, i like JSoup. Like
Document d = null;
try {
d = Jsoup.connect("https://play.google.com/store/apps/details?id=" + packageName).get();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Then you should parse that document for the following tag ""
Elements div = d.getElementsByAttributeValueContaining("class", "doc-banner-icon");
String path = div.get(0).attr("src");
This path variable should be the path for the image to download. I have not tested this.
Nope
There is no official API for market content. Be it to retrieve icons or anything else.
If you are just interested in getting the image files you can download them manually via the web front end to the Market. But I wouldn't write code to do this, as it is very likely that they will make a change to the web front end that will result in your code breaking. p.s. I am no lawyer, but also I don't think there is very much that you would be "allowed" to do with these images even if you did download them (without permission from each developer of course)
The answer by Jug6ernaut will no longer work. This works as of November 2016:
#WorkerThread public static String scrapeGooglePlayIcon(#NonNull String packageName) throws IOException {
return Jsoup.connect("https://play.google.com/store/apps/details?id=" + packageName).get()
.select("div[class=details-info] > div[class=cover-container] > img[class=cover-image]")
.attr("abs:src");
}
I created a small library that web scrapes the Google Play store. If this stops working in the future, please comment or create an issue on the GitHub project: https://github.com/jaredrummler/GooglePlayScraper
You could create a Yahoo Pipes like this http://kcy.me/hylg it will parse the page for you and extract a JSON in wich you could read the sinlge image URL.
http://kcy.me/hylj
You can parameterize the pipe in order to receive the link to the app you want to extract the image.
The simple solution is that just right click on the icon of the app from Chrom browser and save image as, this will save the icon with webp extension, now use this Conver webp to png
to convert the icon to PNG.

Categories

Resources