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

Fetch usernames from cs.com #6

Open
chmac opened this issue Dec 8, 2020 · 3 comments
Open

Fetch usernames from cs.com #6

chmac opened this issue Dec 8, 2020 · 3 comments

Comments

@chmac
Copy link
Contributor

chmac commented Dec 8, 2020

Linked to #5, the main thing I want to do programmatically is grab the CS profile links of all my friends, and those who still have profiles, capture something. Name, maybe picture, but whatever, something more useful than a useless ID.

This would make more sense as part of some kind of one-time export conversion script, rather than on every load of the data.

@simison
Copy link
Owner

simison commented Dec 22, 2020

Yeah, this would be fantastic! It's a real bummer files don't include at least names.

I actually started implementing it when first working on this, but quickly gave up since it became kinda complicated. There's some code in add/profile-fetching branch:

https://github.com/simison/couchspinner/blob/6833f123a1f5fda8a057bd6af2bc8b6915511f9b/src/worker.js

  • Since the app runs fully on client-side (it's hosted from Github-pages), you would need to use external service to do the fetching at server-side to overcome CORS issues. It's possible to run something like CorsAnywhere on Heroku just for this purpose.
  • There are mitigations at CS side for this type of crawling tons of profiles. In the code you can see I tried to overcome that with perimeterx-axios-interceptor
  • Lots of profiles are still private so some of the profiles are still unreachable. Not end of the world of course. :-)
  • Related to above, I didn't feel comfortable asking for username+pass, and do the authentication dance. Nobody should enter their credentials on some random website. 😅 Not feeling super strong about this so it would be fine.

Lastly, worth just writing CS folks if they would like to add names to export files. :-D It would be the right thing to do.

@simison
Copy link
Owner

simison commented Dec 22, 2020

Lots of profiles are still private so some of the profiles are still unreachable.

Actually reading the code again, looks like name and image are always available in og-tags even for private profiles. So prolly not an issue. :-)

@chmac
Copy link
Contributor Author

chmac commented Jan 14, 2021

I submitted a PR that does some downloading. It adds a 10s delay between requests. In my ~370 friends, I got 230 real profiles and ~140 copies of the CouchSurfing homepage. I just ran it as a script.

The CORS issue would be a headache to do this client side for sure. 🤔

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

No branches or pull requests

2 participants