manu-chroma / username-availability-checker

Live at : https://username-check.herokuapp.com/
96 stars 37 forks source link

pinterest.com is reporting taken for usernames which are not taken #17

Closed jayvdb closed 6 years ago

manu-chroma commented 6 years ago

Unfortunately, HTTP code is 200 for both url having taken/available usernames.

In [1]: import requests as r
In [2]: url_taken = 'https://in.pinterest.com/manvendra0310/'
In [3]: res = r.get(url_taken)
In [4]: res.status_code
Out[4]: 200

In [5]: res.history
Out[5]: []

In [6]: url_available = 'https://in.pinterest.com/manvendraaaa/'
In [7]: res = r.get(url_available)
In [8]: res.status_code
Out[8]: 200

In [9]: res.history
Out[9]: [<Response [302]>]

I'm implementing a hacky solution for the time being and should fix the issue for now. https://github.com/manu-chroma/username-availability-checker/commit/d7be1dda5ba1faf074aeb629f07827338dc06ec3

manu-chroma commented 6 years ago

Changes should reflect on the website now. Also, there is improvement in the front end UI and basic regex in the input filed on webpage.

manu-chroma commented 6 years ago

@jayvdb which one is more fault tolerant in your opinion?

len(res.history) > 0 or bytes(username, encoding='utf-8') in res.content

jayvdb commented 6 years ago

I think bytes(username, encoding='utf-8') in res.content is the more stable & re-usable algorithm.

manu-chroma commented 6 years ago

Addressed in: https://github.com/manu-chroma/username-availability-checker/commit/0acde56bf11e28326f1a4a6e3e8e40493c448e99

Closing.