Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve Reddit title when sharing link with floccus on on Android #1854

Open
de-code opened this issue Feb 3, 2025 · 5 comments
Open

Retrieve Reddit title when sharing link with floccus on on Android #1854

de-code opened this issue Feb 3, 2025 · 5 comments

Comments

@de-code
Copy link

de-code commented Feb 3, 2025

Describe the feature you'd like to request

Currently when sharing a Reddit link with floccus on it just populates the title with the generic title "Reddit - Dive into anything".
Instead it should use the title of the actual Reddit post.

So for example when sharing https://www.reddit.com/r/browsers/comments/lxhiyt/floccus_now_supports_syncing_bookmarks_across/, the title should be floccus now supports syncing bookmarks across browsers via Google Drive .

Describe the solution you'd like

While the title element in the header is generic, there are places within the HTML that do contain the title:

      <h1
      id="post-title-t3_lxhiyt"
      slot="title"
      class="font-semibold text-neutral-content-strong m-0 text-18 xs:text-24  mb-xs px-md xs:px-0 xs:mb-md  overflow-hidden"
      aria-label="Post Title: floccus now supports syncing bookmarks across browsers via Google Drive"
      aria-describedby="feed-post-credit-bar-t3_lxhiyt"
    >
       floccus now supports syncing bookmarks across browsers via Google Drive <faceplate-perfmark name="first-post-meaningful-paint"></faceplate-perfmark>
    </h1>

And:

<shreddit-title title="floccus now supports syncing bookmarks across browsers via Google Drive : r/browsers"></shreddit-title>

Describe alternatives you've considered

I tried sharing with Brave browser and Stealth Reddit client.

Another alternative is to share the link with myself on some messaging app to proceed on a desktop (not using floccus in that case).

Copy link

github-actions bot commented Feb 3, 2025

Hello 👋

Thank you for taking the time to open this issue with floccus. I know it's frustrating when software
causes problems. You have made the right choice to come here and open an issue to make sure your problem gets looked at
and if possible solved.
I'm Marcel and I created floccus a few years ago, maintaining it ever since. I currently work for Nextcloud
which leaves me with less time for side projects like this one than I used to have.
I still try to answer all issues and if possible fix all bugs here, but it sometimes takes a while until I get to it.
Until then, please be patient.
Note also that GitHub is a place where people meet to make software better together. Nobody here is under any obligation
to help you, solve your problems or deliver on any expectations or demands you may have, but if enough people come together we can
collaborate to make this software better. For everyone.
Thus, if you can, you could also have a look at other issues to see whether you can help other people with your knowledge
and experience. If you have coding experience it would also be awesome if you could step up to dive into the code and
try to fix the odd bug yourself. Everyone will be thankful for extra helping hands!
To continue the development and maintenance of this project in a sustainable way I ask that you donate to the project when opening an issue
(or at least once your issue is solved), if you're not a donor already.
You can find donation options at https://floccus.org/donate/. Thank you!

One last word: If you feel, at any point, like you need to vent, this is not the place for it; you can go to the Nextcloud forum,
to twitter or somewhere else. But this is a technical issue tracker, so please make sure to
focus on the tech and keep your opinions to yourself.

I look forward to working with you on this issue
Cheers 💙

@marcelklehr
Copy link
Member

Hi @de-code
Mmh, this it tricky to do, I think. Floccus already fetches the URL and checks the title meta element. If reddit's title element does not contain useful information, I think this is out of scope for floccus, even though I realize that this is not a desireable outcome for you. What we can look into is whether the data shared from other apps contains the title in a weird format maybe that we can try to extract.

@andybalaam Perhaps you have some insight here :)

@andybalaam
Copy link
Contributor

Yeah the example I dealt with was when the Amazon app included the title+URL all in the url part: #1830

Maybe Reddit includes the info in some other unexpected place. We could make progress by logging out exactly what Reddit sends us, which I think we would do here: https://github.com/floccusaddon/floccus/blob/develop/src/ui/views/native/AddBookmarkIntent.vue#L103

@de-code
Copy link
Author

de-code commented Feb 3, 2025

Thank you for getting back quickly.

I currently don't have any android dev tools setup. But could try to do that if that was helpful.

As mentioned, the issue is with both sharing link via Stealth and Brave. If I was sharing with a messaging app, it would just be the link (no other text). Although in Stealth I also have the option of "Share Post" which would share text as well. In Brave I don't see any other option.

Given that Reddit is fairly widely used and you are already fetching the URL, would it not be relatively simple to just look for the title in a different field depending on the hostname?

Do you use another Android browser where that would work better?

@andybalaam
Copy link
Contributor

andybalaam commented Feb 4, 2025

Ah, I misunderstood and thought the link was being shared by the Reddit App, but I see now that it was from a browser. I see the same behaviour when I share a reddit link from mobile Firefox to floccus on my Android phone.

I think there are 2 questions:

  1. What information does Firefox/Stealth/Brave send to floccus when you hit "share"? If the information is in there, but garbled, we can extract it out. This is what I was talking about in my last comment.
  2. Should floccus make a title by fetching it from the URL? From what @marcelklehr said it seems like it can sometimes do that, but it does it based on the title of the page. This seems like the right behaviour by floccus. I guess floccus' behaviour could be modified to use different logic for special URLs that it knows about, but it seems like a lot of work to maintain. (This is what marcelklehr was saying in their comment, I think).

Really, Reddit should return a sensible title for this page :-) I notice that when I load the page in my browser, the tab title starts as "Reddit - dive into anything" and then changes later, presumably based on some JavaScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants