Archive-dot-org simple helper - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Utilities (https://staging.qb64phoenix.com/forumdisplay.php?fid=8) +---- Thread: Archive-dot-org simple helper (/showthread.php?tid=1818) Pages:
1
2
|
Archive-dot-org simple helper - mnrvovrfc - 07-06-2023 This is a program that could make life a bit easier to navigate "archive-dot-org" if the user is only looking to download music or video. N.B. This requires a bit of research to configure the program as desired. As it stands it only works for audio (FLAC, MP3, OGG, WAV etc.) This research is to obtain the "subjects" which are tags that have to be written precisely into a web address. On "archive-dot-org" some categories are written out like plain English, capitalized short phrases with spaces, which cannot stand into a web address. The site has a chooser of subjects which puts down stuff which could be unpredictable. (Sometimes it chooses "multiple categories" which is the same word or words but in different upper-lower-case combinations.) Therefore the user must tinker a little bit to obtain a subject tag for use with this program. It's a vain attempt to make this program more flexible. This program requires one text file, and it's recommended to provide another. The required file has one line which is the full path of the executable to the web browser. Because I programmed this on Linux, I'm not familiar with a way to launch the web browser from an user's QB64 program on MacOS or on Windows. I also programmed to launch the AppImage which might appear clumsy to some of you. This file is not provided, you will have to create it. It is called "helparchorg-browser.txt", it must reside in the same directory as the executable. This program only reads the first line of this file, so make sure it has a correct entry. It's recommended to have also "helparchorg-category.txt". It could also be called "helparchorg-subject.txt". Here you will put down a subject, one per line, for the media that is sought. If you want two categories at a time then put each tag joined by a plus sign. At the moment no more than two categories could be joined. The program reads the text files, tells the user that it found the web browser, and then shows a menu with the categories. If there's only one then it's "electronic", at the moment, but this could be changed in the source code. The user types in a number for the subject or subjects he/she desires and presses [ENTER]. Pressing [ENTER] with no entry quits the program. After that, the user is asked what year of creation or release for the media sought, starting with 2013. Again, this could be modified in the source code. Type in the menu choice for the year, not the year itself LOL, and press [ENTER]. Press [ENTER] without entry at this point to leave the program. This program then launches the web browser with the address fabricated from the data it was given. Code: (Select All)
For this program as it stands, try this as "helparchorg-category.txt": Code: (Select All) electronic RE: Archive-dot-org simple helper - grymmjack - 07-09-2023 This is cool, @mnrvovrfc I had to make some changes to get it to work on windows (filename with space in path, and firefox didn't like the input surrounded in single quotes for the URL). Code: (Select All)
Here is my helparchorg-browser.txt file: Code: (Select All) C:\Program Files\Mozilla Firefox\firefox.exe I tried to put the double quotes in this file, but it wasn't finding the browser as a file that existed per the stuff at the top that checks for it. However, it found it without double quotes there. For the benefit of others here are screenshots of it working: RE: Archive-dot-org simple helper - grymmjack - 07-09-2023 If you wanted to you could detect the OS and then act accordingly I guess? I know Linux/Mac needs the single quoted string because of shell expansion, but that made it try to open the string as a "file://" on Windows. Really neat program, thank you for sharing. RE: Archive-dot-org simple helper - grymmjack - 07-09-2023 Last, I checked for a real API and it exists (sort of): https://archive.org/advancedsearch.php Check that out, it might be helpful - or you may have even already used it to build out what you have created. https://blog.archive.org/developers/ I've done similar things too before, but using dissection/hacking-at-it-to-know-how-it-works, by looking at the form fields, messing with the http posts, etc. Take it easy RE: Archive-dot-org simple helper - mnrvovrfc - 07-09-2023 (07-09-2023, 04:16 PM)grymmjack Wrote: If you wanted to you could detect the OS and then act accordingly I guess? You have done much more than me after I posted this program. Thank you also! RE: Archive-dot-org simple helper - Ultraman - 07-10-2023 Hmmm..... An API? Could be good fun. I am quite fond of all things API. RE: Archive-dot-org simple helper - Ultraman - 07-10-2023 This simple little code will just let you see if a URL is available on the Wayback Machine and automatically open the browser to the webpage if it does. Code: (Select All)
RE: Archive-dot-org simple helper - mnrvovrfc - 07-10-2023 I'd add to the above so the user only has to type in the "main part" of the web address. Then from a menu decide if it's "dot-com", "dot-org" or what is the suffix. Maybe combine that suffix menu for secure protocol or not. Because some "main parts" of web addresses are bad enough to type. Otherwise have to copy an address into the clipboard from somewhere. The presented program is for Windows only, because it's using "start" command. Nevertheless this is a good trick. RE: Archive-dot-org simple helper - Ultraman - 07-10-2023 Yeah, I probably ain't changing any of the code. It was just for a quick one-off to show using the Wayback Machine API on that one particular call. RE: Archive-dot-org simple helper - mnrvovrfc - 07-12-2023 I modified this program because I was bored today. Now it could work on Linux, however it assumes a web browser was "traditionally" installed as set via "Default Applications". Not from an AppImage and maybe not from Flatpak or Snaps. This also works on Windows but the way to input has been changed. Now in the first prompt it is only necessary to put down "qb64phoenix" (without double-quotation marks) instead of the whole shebang. Actually write "s.qb64phoenix" but I will tell you why a bit later. There's a second prompt that asks which suffix to use. If you already put down a suffix on the first prompt then choose "none". If you don't see the one you want out of the ones listed then choose option #5 and enter it, the dot isn't necessary. For this example for this site choose option #1. This should give you "https://qb64phoenix.com" if you did include the "s." at the front of the first prompt of this modified program. In other words: Code: (Select All) First prompt: Second prompt: Result: This is in case the site you're looking for is a rather old one or some other reason it cannot be upgraded by web browser to "secure" protocol. On Linux the screen might act a bit funny while it counts down and then launches the web browser. Also be ready for when the web browser complains "archive-dot-org" itself isn't on "secure" protocol LOL because I had that happen to me while I was trying to test these modifications to look for a different site from decade-2000. Code: (Select All)
|