Jump to content
Ketarin forum

Ambimind

Members
  • Posts

    67
  • Joined

  • Last visited

Posts posted by Ambimind

  1. Ketarin exploits regular expression capture groups to return characters isolated from a larger matched set(example and explanation).
    A problem arises when one requires the use of capture groups for one of their original intended uses - "back references".

    The animation below demonstrates the problem and solution : Wrap the whole expression in parenthesis and increment any back references by 1.
    5nlvneu.gif

  2. @shawn 
    For now I've implemented the following solution:
    Using post-variables(see image below), each Ketarin-job-variable specifies a "redirection-delay", measured in seconds.
    Kuppet will wait for this duration after the initial page load,
    during which it is supposed that any landing-page-timers have completed and the actual page has begun to load,
    after which kuppet will wait till the page has finished loading(absence of network requests for 500ms).

    TWdBxHo.png

  3. 4 hours ago, shawn said:

    Hi! It's not downloading CleanTalk plugin that's the problem, but from sites that are using it. Here's an example. However, the plugin must use a connection counter or something, too, since often the first request (after several hours) works fine but any subsequent request (say, for another app from the same site) will fail. If you setup a new app and just try to capture the version number you'll see how it misbehaves by the second or third request. Here's an app for it though -- Kuppet is used in {versionstub}.

    setdefaultbrowser.xml 4.27 kB · 1 download

    Got it - I can reproduce the behavior at will, now.
    Pardon my confusion; it was clearly stated in your original post.

  4. 1 hour ago, shawn said:

    The plugin is CleanTalk Spam Protect, and it has a built-in Anti-Crawler FireWall that's responsible for imposing a delay of between 3 and 60 seconds with a cookie and cache-buster refresh/redirect that is resulting in Kuppet not making it to the "real" content of the page.

    I'm unable to reproduce the behaviors you've described. I've attached the job I created to test it : It works fine with or without kuppet.

    cleantalk-spam-protect.xml

  5. 5 hours ago, shawn said:

    The user agent option is never properly observed. 

    Nice catch, thank you; I think it should be fixed now.

    5 hours ago, shawn said:

    I don't see that the standard logging option does anything at all.

    If '-L' is used, it implies '-l', in which case, while '-L' is set, setting\unsetting '-l' has no effect. I've added a note about this in the help.
    To prove it to yourself, remove '-L', and set '-l', this should remove all log lines starting with "===:" and retain all those starting with "---:".
    Both can be excluded, in which case no logging occurs.

    5 hours ago, shawn said:

    The visibility option works perfectly - in that it either shows or hides the Chrome sandbox - usually in the background of monitor 1, but not always -- for some reason this is inconsistent.

    I wasn't able to reproduce this. In order to avoid any possible confusion the '-V'(capitalized v) option is removed from the cmd-interface.
    If a request is served from cache, chrome is not launched. I found this may give the impression of inconsistency, when it is by design.
    I've updated the config file with the relevant key 'chromeVisible'; I suggest using 'true'/'false'(without quotes) in place of '0'/'1'.

    Usage Note
    When setting command line options within Ketarin global variables, the options must be quoted and separated by spaces, as shown below: 
    if(!(PS kuppet -ea 0)) {START -win hidden BIN\kuppet '-v --port=9000'}

  6. Thanks for clearly reporting your problem, jusseppe.
    Please try the new version I've uploaded(see original post); I think I've found the cause of the error - entirely my fault.
    Also, see the working example I've uploaded.

    An alternative resolution : If your firewall is not blocking chrome and\or kuppet, you can try changing kuppets default working port :
    cs4i4MS.jpg

    Tip : If you remove "-WindowStyle hidden" from the command line, kuppet will tell you a short story ;)

  7. PswP11w.png

    Download Link

    17 April 2022 Update

    - In summary, kuppet now has a proper command-line interface,  can be used standalone and also handles the shadow DOM.
    - All dependencies have been updated to their latest versions.
    - Documentation is now improved, please make use of -h or --help options to access it.

    18 April 2022 Update
    - Fixed bug preventing application of user agent string
    - Removed "-V" options
    - Updated config file

    21 April 2022 Update
    - Implemented request specific options through post data
    - Added post data option redirection-delay
    - Improved readability of standard logs, "-l"

    Logitech_Options.xml

  8. On 4/14/2021 at 1:35 PM, vertigo said:

    I'm not sure how to accomplish A, though, and would appreciate if you could give a brief explanation.

    The URL shown in solution A is taken from AIMP's windows download page. While it includes no obvious reference to an executable, when followed, their web server will always redirect to the latest version of AIMP's exe.
    When a Ketarin variable is provided a URL which does not refer to a file containing searchable textual content, it returns the file's HTTP headers instead; this feature is used to determine the latest version+build number, in solution A.

    On 4/14/2021 at 1:35 PM, vertigo said:

    And I'd also still like clarification on how it's decided what part of a match is actually used

    When regular expressions employ "capturing groups"(eg. G1 & G2), only the first capturing group(G1) match, backed by red, is returned.
    This is true even when another, valid capturing group(G2) is matched(not marked by Ketarin).
    In this scenario blue backed text indicates the rest of the text matched by the regex - not returned.

    When capturing groups are absent from a regex, blue backed text indicates the match that will be returned as the variable value.

    Note : I've deliberately shortened the original regex to improve readability.

    kq98QEC.png

  9. I understand your ultimate goal to be : Retrieve AIMP's current version number, including build number, in the following format : [versionNumber].[build]

    Below I present two possible solutions using Ketarin.

    Solution A  retrieves HTTP headers for the file, then extracts the version and build info from the file name - all within a single variable.

    Solution B uses two dependent variables : First the version+build string is extracted from the webpage in versionstr, then the ", build " text is removed using a replace function in version(note that version's contents is set to "Textual content").

    KsTJKOo.png

    kgchtnM.png

  10. @Sydnelson

    What I do atm :
    1. Create separate Ketarin jobs for each version.
    2. During installation run both, but ...
    3. Each job checks for the windows version and architecture appropriate for the program.
    4. Installation occurs only when conditions are met.

    In case you need to download additional files, use Powershell's wget\Invoke-WebRequest,
    or GNU wget, stored next to the Ketarin executable, eg. "{startuppath}\BIN\wget.exe".


    If you're new to Ketarin I can provide a more detailed step-by-step answer if you like?

  11. @Etz

    What errors does Ketarin log show?

    Tried the script with slight modifications, to account for assumption not met by my system, without issue.
    Functional modifications : Finds executables in current app dir, rather than dir specified in "portable".
    Tested as an app\job specific script, not global.


    Global variable shortcuts = C:\

    $PortableAppsPath = (Get-Item $app.CurrentLocation).DirectoryName
    $WShell = New-Object -ComObject WScript.Shell
    $Executables = Get-ChildItem (Get-Item $app.CurrentLocation).DirectoryName -Filter '*.exe' -Recurse
    if ($Executables.Count -gt 1) {
        $ShortCutPath = Join-Path $globalvars.'shortcuts'.CachedContent $app.Name
        if (-Not(Test-Path $ShortCutPath -PathType Container)) {
            New-Item $ShortCutPath -ItemType Directory -Force
        }
    } else {
        $ShortCutPath = Join-Path $globalvars.'shortcuts'.CachedContent $app.Name
    }
    foreach ($Executable in $Executables) {
        $ShortCut = $WShell.CreateShortcut("$ShortCutPath\$($Executable.BaseName).lnk")
        $Shortcut.TargetPath = $Executable.FullName
        $Shortcut.WorkingDirectory = (Join-Path $PortableAppsPath $App.Name)
        $Shortcut.IconLocation = $Executable.FullName
        $Shortcut.Save()
    }

     

  12. Thanks for the feedback.

    I've identified the number of download segments as cause for the difference between our results.
    In my original post the value is set to 1, resulting in an extended delay of 2-4 minutes - not present with segments set to 2 or more(your case).
    Seems to apply only to the first job run; after the file is downloaded successive job runs are not delayed in either case.
    I wrongly assumed failure because of this extended delay and lack of valid download indicator.

  13. Google Drive direct links not downloading, with unusual behavior

    Context
    Have written a Powershell script to get direct download URL of Google Drive stored files.
    The URL produced can be used in any web-browser to download the file directly, but not in Ketarin(depending on file type).

    To reproduce

    1. Import gdrive_test.xml into Ketarin.
    2. Update the job.

    Expected outcome
    Video_2017-10-09_100723.gif.4cdea762d067db7e7c41d2484ad84575.gif

    Qualifications

    1. This behavior depends on the file-type : .zip and .mp4 files will fail, while .jpg and .doc files will download.
    2. Different files may be tested by changing the "gid" variable to a valid Google Drive file id(the included refers to a zip file).
    3. The derived url being used is logged under "====== GOOGLE DRIVE URL ======".


    Thanks for taking a look

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.