Jump to content

Acidham

Member
  • Posts

    429
  • Joined

  • Last visited

  • Days Won

    19

Posts posted by Acidham

  1. I don't use bookmarks at all. Instead, I built this workflow that relies heavily on my browser history. For me, the URLs I visit frequently become my 'bookmarks' in a way.

     

    Since Arc imports bookmarks from other browsers but doesn't support them natively, it hasn't been an issue for me. I navigate mostly through my history, which effectively serves as a dynamic list of my most visited and important sites.

    Curious to hear how others are adapting to this or if anyone else has ditched traditional bookmarks for a more fluid approach like history search.

  2. @Stephen_C I just shared via direct message a fixed code snipped, but I am uncertain if the message was ever sent. Therefore, here again. The new code should fix most of the issues when reading the title of a webpage. Just replace the code in WF with the code below.

     

    import urllib.request
    
    
    import re
    import os
    import http.cookiejar
    
    
    def fetch_webpage_title(url):
        try:
            cj = http.cookiejar.CookieJar()
            opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
           
            headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.3'}
            request = urllib.request.Request(url, headers=headers)
            response = opener.open(request)
    
    
            
            # response = urllib.request.urlopen(url)
            html = response.read().decode('utf-8',errors='ignore')
        
            title_match = re.search('<title>(.*?)</title>', html, re.IGNORECASE)
            
            # Extract the title if found
            if title_match:
                return title_match.group(1).strip()
            else:
                return ""
        except Exception as e:
            return ""
    
    
    url = os.getenv('theURL')
    print(fetch_webpage_title(url))
    
    
    

     

  3. @Stephen_C uups sorry forgot to return an empty string instead of returning the error. And shame on me, I did not test it enough.

     

    i changed the line return f"An error occurred: {e}" to return ""

     

    import urllib.request
    
    import re
    import os
    
    def fetch_webpage_title(url):
        try:
            # Fetch the webpage content
            response = urllib.request.urlopen(url)
            html = response.read().decode('utf-8',errors='ignore')
            
            # Use regex to find the title tag
            title_match = re.search('<title>(.*?)</title>', html, re.IGNORECASE)
            
            # Extract the title if found
            if title_match:
                return title_match.group(1).strip()
            else:
                return ""
        except Exception as e:
            return ""
    
    
    url = os.getenv('theURL')
    print(fetch_webpage_title(url))
    
    
  4. @Stephen_C In order to extract the title of a webpage as a prefill for the prompt, I added the following Python script as a WF step. It would be great to add it to your workflow…

     

     

    image.thumb.png.6ca2954769cc966a2b3642d4a6d34ec8.png

     

    Python3 script:

     

    import urllib.request
    
    
    import re
    import os
    
    
    def fetch_webpage_title(url):
        try:
            # Fetch the webpage content
            response = urllib.request.urlopen(url)
            html = response.read().decode('utf-8',errors='ignore')
            
            # Use regex to find the title tag
            title_match = re.search('<title>(.*?)</title>', html, re.IGNORECASE)
            
            # Extract the title if found
            if title_match:
                return title_match.group(1).strip()
            else:
                return ""
        except Exception as e:
            return f"An error occurred: {e}"
    
    
    url = os.getenv('theURL')
    print(fetch_webpage_title(url))
    
    
    

  5. Here's a rundown of what each option in the rsync command does:

    -r: This stands for "recursive," which means that rsync will copy all subdirectories and their contents, not just the files in the top-level directory.

    -t: This option preserves the modification times of files.

    -v: "Verbose." This makes rsync provide more detailed output about what it's doing.

    -u: This tells rsync to only copy files that have a more recent modification time on the source than on the target. In other words, if the target file is newer or the same age as the source file, it won't be overwritten.

    -c: Instead of just looking at file modification times, this option makes rsync check the contents of files to determine whether they need to be copied. It uses a checksum for this.

    --delete-after: This option means that after rsync has copied all the necessary files, it will delete any files in the target directory that aren't in the source directory. It ensures that the target becomes a mirror image of the source.

    --ignore-errors: This tells rsync to continue transferring the rest of the files even if some files give errors.

    --stats: This option makes rsync provide a summary of how much data was transferred and other related stats.

  6. > Now I want to change destination in rsync for incremental backup but don't want to add again and do full backup

     

    you can change in config json but you can also delete and add again. Rsync does not perform a full backup it just sync, means it starts where you ended before you deleted the entry.

  7. @xilopaint Are there any other possibilities to lookup Alfred Workflow and Shortcuts similar to what `Alfred Search Workflow` provides? If yes, I changed to define shortcuts in User Configuration. Otherwise, I would refrain from the “good practice”. 
    Define KS in User Configuration is ok, but I would rather not open User configuration all the time to look up KS. For me, it looks like a workaround rather than a good practice. 

  8. @xilopaint 


     I think you should use the keyword for history search with Argument Optional.
    


    Makes sense!


    Also, it’s a good practice to include an option to change the keywords in the user configuration panel.
    


    I doubt that this is good practice. I am often using this workflow (https://alfred.app/workflows/acidham/search-alfred-workflows/) to find the right workflow. With pressing SHIFT, I get a documentation with keyboard shortcuts. When using configurable keywords, I am just seeing a variable name, which does not help at all. 


    I would adopt hi and bm as default.
    


    You can do that by just changing the shortcut, right?

  9. Currently it’s showing dark Chrome icon and not many use Chrome.


    The Chrome icon is a fallback icon in case favicon cannot be found. The idea is to show pages in a search result that belong together. For example, searching for Alfred …the results are visually grouped together.

     

     

    Screenshot 2023-07-02 at 08.57.52.png

  10. On 6/27/2023 at 12:07 PM, json12 said:

    Works great! Thank you. Couple suggestions:

     

    1. Is it possible to add search for open tabs? 

    2. Anyway to show icon of browser instead favicons of the link? 

     

    1. Tab search is not supported for History and Bookmark search. There are other workflows available to perform Tab search.
    2. What is the value of the browser icon? The use case is to have an independent search across all browsers in use, but it always opens in the default browser or if you press CMD + ENTER you can open in another browser. 
  11. On 6/13/2023 at 11:09 PM, taofuns said:

    is there any way to search safari bookmarks and history in the same time like spotlight do?

    Most of times, when I didn’t add one website to bookmark, I can’t get the search result even if I visit that website frequently.

    I’ve asked @alfredapp this question on twitter, and got the workflow ”Chromium Bookmarks and History Search”, I’ve installed it, but this workflow allows the search of the two with separate keywords, so how to tweak it to show both at once?

    I tried modify the trigger keyword to the same, but it didn’t work.

    I am not familiar with creating workflow, so please show step by step.

    Screenshot 2023-06-14 at 5.07.35 AM.jpg

    Screenshot 2023-06-14 at 5.09.25 AM.jpg

     

    Currently, there is no way to merge both searches into one keyword.

  12. 11 hours ago, andy4222 said:

    but any way the performance of this workflow can be improved

    I am on M1 Pro as well, but search works superfast. Improving performance implies I need to be able to reproduce first or being able to narrow down to one of the browsers. 

     

    I suggest starting, narrowing the problem down to one Browser. Delete history files and start from scratch and see when performance gets worse, etc. 

     

    Once reproducible, I am happy to look into the issue. 

×
×
  • Create New...