Chromecast backgrounds RSS

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Chromecast backgrounds RSS

Post by Antonio Linares »

I have been using John's Background switcher for years, and since I tested the Chromecast screensaver I wanted to have all those great photos available on my desktop too

Today I found a GitHub project that provides a list of Chromecast photos with 700 photos, so I used this small PRG to turn it into a valid RSS:

https://github.com/FiveTechSoft/chromecast-backgrounds

Code: Select all

#define CRLF Chr( 13 ) + Chr( 10 )

function Main()
    
   local aLines := HB_aTokens( MemoRead( "README.md" ), Chr( 10 ) )
   local cRSS
 
   cRSS = '<?xml version="1.0" encoding="utf-8"?>' + CRLF
   cRSS += '<rss version="2.0">' + CRLF
   cRSS += '<channel>' + CRLF
   cRSS += "<title>chromecast-backgrounds</title>" + CRLF
   cRSS += "<link>https://github.com/FiveTechSoft/chromecast-backgrounds</link>" + CRLF 
   cRSS += "<description>dconnolly chromecast-backgrounds collection</description>" + CRLF
 
   AEval( aLines, { | cLine, n | cRSS += StrTran( StrTran( cLine, "![](", "<item>" + CRLF + ;
          "<title>" + AllTrim( Str( n ) ) + "</title>" + CRLF + "<link>" ), ")",;
          "</link>" + CRLF + "</item>" ) + CRLF } )
   
   hb_MemoWrit( "test.rss", SubStr( cRSS, 1, Len( cRSS ) - 2 ) + "</channel>" + CRLF + "</rss>" )

return nil
So I forked the GitHub project, and added the RSS feed and it is working really fine from John's Background switcher:
https://raw.githubusercontent.com/FiveT ... r/test.rss
regards, saludos

Antonio Linares
www.fivetechsoft.com
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: Chromecast backgrounds RSS

Post by hmpaquito »

Impresionantes fotos.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Chromecast backgrounds RSS

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Chromecast backgrounds RSS

Post by Antonio Linares »

Here there is a JSON file with lots of ChromeCast pictures:
https://chromecastbg.alexmeub.com/images.v9.json

This PRG generates a RSS file from it:

Code: Select all

#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local aImages := hb_JsonDecode( MemoRead( "c:\temp\images.v9.json" ) )
   local hImage, cRSS
 
   cRSS = '<?xml version="1.0" encoding="utf-8"?>' + CRLF
   cRSS += '<rss version="2.0">' + CRLF
   cRSS += '<channel>' + CRLF
   cRSS += "<title>chromecast-backgrounds</title>" + CRLF
   cRSS += "<link>https://github.com/FiveTechSoft/chromecast-backgrounds</link>" + CRLF
   cRSS += "<description>dconnolly chromecast-backgrounds collection</description>" + CRLF
   
   for each hImage in aImages
      cRSS += "<item>" + CRLF
      cRSS += "<title>" + AllTrim( Str( hImage:__enumIndex ) ) + "</title>" + CRLF
      cRSS += "<link>" + hImage[ "url" ] + "</link>" + CRLF
      cRSS += "</item>" + CRLF
   next
   
   cRSS += "</channel>" + CRLF
   cRSS += "</rss>"
   
   hb_MemoWrit( "c:\temp\images.v9.rss", cRSS )

return nil
Here it is the resulting RSS file:
https://raw.githubusercontent.com/FiveT ... ges.v9.rss
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Chromecast backgrounds RSS

Post by Antonio Linares »

I found an easy way to get all the photos that ChromeCast uses from its url:
https://clients3.google.com/cast/chromecast/home

Simply open it from Chrome, inspect it using F12 and select "network", click on "Preserve log" and wait...:
Image

Let it be there for hours, the log will grow, finally click on "down arrow" (Export HAR) and it will create a JSON file on disk.

Now use this PRG to extract the URLs from it:
rss.prg

Code: Select all

#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har" ) )
   local hEntry, cRSS

   cRSS = '<?xml version="1.0" encoding="utf-8"?>' + CRLF
   cRSS += '<rss version="2.0">' + CRLF
   cRSS += '<channel>' + CRLF
   cRSS += "<title>chromecast-backgrounds</title>" + CRLF
   cRSS += "<link>https://github.com/FiveTechSoft/chromecast-backgrounds</link>" + CRLF
   cRSS += "<description>chromecast-backgrounds collection</description>" + CRLF
   
   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         cRSS += "<item>" + CRLF
         cRSS += "<title>" + AllTrim( Str( hEntry:__enumIndex ) ) + "</title>" + CRLF
         cRSS += "<link>" + hEntry[ "request" ][ "url" ] + "</link>" + CRLF
         cRSS += "</item>" + CRLF
      endif 
   next        

   cRSS += "</channel>" + CRLF
   cRSS += "</rss>"
   
   hb_MemoWrit( "c:\temp\clients3.google.com.har.rss", cRSS )

return nil
It will create a RSS file with all the photos URLs into it that you can use from John's Background Switcher for your PC desktop images:
https://raw.githubusercontent.com/FiveT ... om.har.rss
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Chromecast backgrounds RSS

Post by Antonio Linares »

A modified version to post the images here:

phpbb.prg

Code: Select all

#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har" ) )
   local hEntry, cRSS := ""

   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         cRSS += "[img]"%20+%20hEntry[%20"request"%20][%20"url"%20]%20+%20"[/img]" + CRLF
      endif 
   next        
   
   hb_MemoWrit( "c:\temp\phpbb.post", cRSS )

return nil
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Chromecast backgrounds RSS

Post by Antonio Linares »

This version creates a md file that you can post on github:

md.prg

Code: Select all

#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har" ) )
   local hEntry, cRSS := ""

   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         cRSS += "![](" + hEntry[ "request" ][ "url" ] + ")" + CRLF
      endif 
   next        
   
   hb_MemoWrit( "c:\temp\backgrounds.md", cRSS )

return nil
https://github.com/FiveTechSoft/chromec ... grounds.md
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Chromecast backgrounds RSS

Post by Antonio Linares »

And a great music to listen meanwhile you watch the images :-D

https://journeyscapesradio.blogspot.com ... layer.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Chromecast backgrounds RSS

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Chromecast backgrounds RSS

Post by Antonio Linares »

After saving the Chrome log file, use this PRG to save the images to local files:

saveimages.prg

Code: Select all

#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har" ) )
   local hEntry, aImages := {}, cImage

   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         if AScan( aImages, hEntry[ "request" ][ "url" ] ) == 0 
            AAdd( aImages, hEntry[ "request" ][ "url" ] ) 
            hb_MemoWrit( "c:\temp\" + AllTrim( Str( Len( aImages ) ) ) + ".jfif",;
                         WebImage( hEntry[ "request" ][ "url" ] ) )
         endif   
      endif
   next        
   
   MsgInfo( "done" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Chromecast backgrounds RSS

Post by Antonio Linares »

Enhanced version that saves all the photos, and erase duplicated photos

chromebg.prg

Code: Select all

// Download images from the ChromeCast backgrounds images log file in Chrome network inspector

#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har2.har" ) )
   local hEntry, aImages := {}, cImage, aFiles

   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         if AScan( aImages, hEntry[ "request" ][ "url" ] ) == 0 
            AAdd( aImages, hEntry[ "request" ][ "url" ] ) 
            hb_MemoWrit( "c:\Users\anto\pictures\" + DToS( Date() ) + "_" + hb_ntos( Seconds() ) + ".jfif",;
                         WebImage( hEntry[ "request" ][ "url" ] ) )
         endif   
      endif
   next        

   aFiles = Directory( "c:\Users\anto\pictures\*.jfif" )
   ASort( aFiles,,, { | x, y | If( x[ 2 ] == y[ 2 ], FErase( "c:\Users\anto\pictures\" + y[ 1 ] ),), x[ 2 ] < y[ 2 ] } )
   
   MsgInfo( "done" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply