Download videos, now easier than ever

SMTube is a YouTube browser that can be used along with SMPlayer. Let's talk about it.

Re: Download videos, now easier than ever

Postby zzd10h » Sat Feb 27, 2016 12:17 pm

Hi,
no error message.

D_BUTTON is ok it should be the evaluateJavaScript() that failed on AmigaOS4. Do you know a way to display the return code of this function ?

the following simple printf return,
ifdef D_BUTTON OK
add_download_button OK


Code: Select all
void BrowserWindow::finishLoading(bool) {
...
#ifdef D_BUTTON
...
printf("ifdef D_BUTTON OK \n");

   if (add_download_button && url.contains("/info.php?") &&
      (external_download_url.contains("%YT_URL%") || external_download_url.contains("%YT_ID%")))
   {

printf("add_download_button OK \n");

      code =   "var video_url = document.getElementById('video_thumbnail').href;"
...
            "}";

      view->page()->mainFrame()->evaluateJavaScript(code);
   }
#endif
}


thx
zzd10h
 
Posts: 120
Joined: Sat Jan 11, 2014 9:24 am
Location: France

Re: Download videos, now easier than ever

Postby rvm » Sat Feb 27, 2016 1:12 pm

You can get the result of that function with this:
Code: Select all
QVariant result = view->page()->mainFrame()->evaluateJavaScript(code);
qDebug() << "result:" << result;


It should output something like this:
Code: Select all
result: QVariant(QString, "<td colspan="5">Publicado por <a href="search.php?channelId=UCHQ0xnF1-2t369UmWE7i5qw&amp;channelTitle=CAMTFP">CAMTFP</a></td><td><a target="_blank" class="btn btn-primary btn-xs" title="Descargar el vídeo usando un servicio externo" href="http://www.dlvyoutube.com/http://www.youtube.com/watch?v=773jDzlbC4U"><span class="glyphicon glyphicon-download"></span> Descargar</a></td>")


You can also output text from the javascript code using console.log, for example here I added two lines to output the variables video_url and video_id:
Code: Select all
                code =  "var video_url = document.getElementById('video_thumbnail').href;"

                                "console.log('video_url: ' + video_url);"

                                "if (video_url) {"
                                        "var video_id = document.getElementById('video_thumbnail').dataset.id;"

                                        "console.log('video_id: ' + video_id);"
                                        ...
                                "}";
rvm
Site Admin
 
Posts: 2804
Joined: Wed Dec 23, 2009 1:25 am
Location: España

Re: Download videos, now easier than ever

Postby zzd10h » Sat Feb 27, 2016 1:45 pm

Thank you,
using QVariant method, result = "QVariant(, )" :(

Code: Select all
QVariant result = view->page()->mainFrame()->evaluateJavaScript(code);
qDebug() << "BrowserWindow::finishLoading: evaluateJavaScript:" << result;



BrowserWindow::finishLoading: url: "http://www.tonvid.com/info.php?video_id=qXn_PHW3RLw&title=UG9pbnQgQ3VsdHVyZSA6IExlcyB0aMOpb3JpZXMgZGUgZmFuIGF1IGNpbsOpbWEgKDLDqG1lIHBhcnRpZSk="
BrowserWindow::finishLoading: add_download_button: true
BrowserWindow::finishLoading: external_download_url: "http://www.dlvyoutube.com/YT_URL"
BrowserWindow::finishLoading: evaluateJavaScript: QVariant(, )
zzd10h
 
Posts: 120
Joined: Sat Jan 11, 2014 9:24 am
Location: France

Re: Download videos, now easier than ever

Postby rvm » Fri Mar 04, 2016 3:09 am

Were you using smtube in French?

I've just find out that it fails to add the download button when using the French translation.

Could you test if version r7479 still has the problem?
rvm
Site Admin
 
Posts: 2804
Joined: Wed Dec 23, 2009 1:25 am
Location: España

Re: Download videos, now easier than ever

Postby zzd10h » Fri Mar 04, 2016 7:58 am

Yes, I'm using French translation.

Unfortunately, r7479 doesn't work better for me. It doesn't work in English too.

Thank you
zzd10h
 
Posts: 120
Joined: Sat Jan 11, 2014 9:24 am
Location: France

Re: Download videos, now easier than ever

Postby scootergrisen » Thu Mar 31, 2016 4:04 pm

I would prefer the Download button to be next to the More information button.
So i dont have to go into more information to find the button.
scootergrisen
 
Posts: 268
Joined: Sat Mar 07, 2015 1:43 am

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest