Using HTTP Get to retrieve comic image

161 views
Skip to first unread message

Rudd Milam

unread,
Jan 2, 2024, 12:08:57 PM1/2/24
to Tasker
I am using HTTP Get to retrieve a comic strip i read. For now I have saved the web page to a text file and split it down to the name of the file  I want to retrieve. But I understand that HTTP Get can get the file directly. Only I almost know nothing about HTML or the syntax to retrieve the file.

Any help out there?

joaomgcd

unread,
Jan 3, 2024, 6:06:29 AM1/3/24
to Tasker
Can you give me an example of the page you're trying to get the comic strip from? I can help you figure it out :) Thanks!

Rudd Milam

unread,
Jan 12, 2024, 1:11:57 PM1/12/24
to Tasker
Sorry for the delay. I've been side tracked by most everything lately. Too many projects.


Right now I read the page to a text file and split multiple times down to the line with the comic file name.

João Dias

unread,
Jan 12, 2024, 1:35:11 PM1/12/24
to tas...@googlegroups.com
Ok, here you go :)

This works nicely! It downloads comic and opens it as a file.

    Task: Get Comic
   
    A1: HTTP Request [
         Method: GET
         URL: https://www.gocomics.com/bc/2024/01/12
         Timeout (Seconds): 30
         Structure Output (JSON, etc): On ]
   
    A2: Variable Set [
         Name: %image_url
         To: %http_data[.item-comic-image>img=:=src]
         Structure Output (JSON, etc): On ]
   
    A3: Variable Set [
         Name: %file
         To: Download/comic.jpg
         Structure Output (JSON, etc): On ]
   
    A4: HTTP Request [
         Method: GET
         URL: %image_url
         File/Directory To Save With Output: %file
         Timeout (Seconds): 30 ]
   
    A5: Open File [
         File: %file
         Mime Type: image/jpeg ]
   
   
It's using Tasker's native HTML reading capabilities to get the image URL directly :)

Let me know if this helps! 

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias

Message has been deleted
Message has been deleted

Paul K

unread,
Jan 13, 2024, 3:02:56 PM1/13/24
to Tasker
Joao,

This is great! It may be the answer I'm looking for. I want to get the URL for an image out of a Bing Search. But, I can't figure out the right requests. Here is the search: 

https://www.bing.com/images/search?q=car&view=detail&first=1

I reviewed the code, and it seems the image URL sits in a DIV named "cico img-content." I've tried two methods without luck. The first was using your flow from above. I used HTML Request with the GET function. 

A1: HTTP Request [
         Method: GET


         Timeout (Seconds): 30
         Structure Output (JSON, etc): On ]
   
    A2: Variable Set [
         Name: %image_url

         To: %http_data[.cico img-content>img=:=src]           **** I'm not sure how to handle the space here


         Structure Output (JSON, etc): On ]
   
    A3: Variable Set [

         Name: %Html
         To: %image_url


         Structure Output (JSON, etc): On ]
   

  When I review the variable %Html, the value is "%image_url". So it is clear the http_data isn't working right.


METHOD TWO

I tried using AutoTools HTML Read to find the URL for the image. I entered the CSS Query Parameters as follows:

div#b_content div.vm_c div.dg_b.isvctrl div.mmComponent_images_1 ul.0 li.1 div.mm-ebad div.mm-ebad-ctt div.cico.img-content img()=:=src

I define the variable as %imageurl

Then i go to SET the %Html variable to %image_url, but the %Html variable is %image_url.  Any thoughts on where I messed up?


Thanks in advance!


Paul K

unread,
Jan 14, 2024, 4:34:10 PM1/14/24
to Tasker
Ok, I figured it out using AutoTools. For anyone else looking for a solution, here's what I did. I'll post here in case it it helps someone in the future.

  • Using AutoTools Read HTML, take advantage of the "Easy Setup" function at the very top.
  • Plug in the URL and tell it what you're looking for. In my case, I was looking for a single image.
  • AutoTools then auto-filled the Query box with the following:
    • CSS Queries: #iol_fsc > a.iol.fst.iol_fsst.loading > img=:=src
  • Check the variable output text
  • Save out of AutoTools
Run AutoTools and the URL is in the variable defined above! :) 

I would have NEVER found that if it wasn't for a built in AutoTools function. And it took for every to find it! Faceslap.

Cheers!




João Dias

unread,
Jan 15, 2024, 5:20:44 AM1/15/24
to tas...@googlegroups.com
I posted this as a reply to the original thread, but this works too :)

    Task: Test

   
    A1: HTTP Request [
         Method: GET
         URL: https://www.bing.com/images/search?q=car&view=detail&first=1
         Timeout (Seconds): 30
         Automatically Follow Redirects: On

         Structure Output (JSON, etc): On ]
   
    A2: Variable Set [
         Name: %image_url
         To: %http_data[.iol_fst>img=:=src] ]
   
    A3: Browse URL [
         URL: %image_url ]
   
I think it's just a matter of enabling redirects and then using the    .iol_fst>img css query!

Hope this helps!
 


--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/7115adfb-ac59-44cb-bb1b-160d07ae4742n%40googlegroups.com.

Rudd Milam

unread,
Jan 18, 2024, 3:57:19 PM1/18/24
to Tasker
Hi All, This will take me awhile to digest. I'm not much of a programmer. Moe of a fiddler.
Thanks for all the help.

Reply all
Reply to author
Forward
0 new messages