-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add parser for Pocket API #528
Conversation
e58486d
to
2a8f2ff
Compare
This looks great. I think it's reasonable to get the Pocket API credentials from config, let me know if you want help with doing that. Also side note: I thought about this for a while, and I think I actually really like your Would be great to have 2 functions for each parser def should_parse_as_pocket_api(text):
return text.startswith('pocket://')
def parse_pocket_api(text):
... |
Yeah, not 100% sure on this part yet, so any help you could provide would be appreciated.
To clarify: Is the idea here to modify all of the extractors to have these two functions and update the loop to use them?
Setting aside for a second how this would apply to the other extractors, I have to admit the
I will say, one of the thoughts I had was to pass the Access key as the username, so I will also mention the overall approach here could be useful for other extractors like Wallabag (related: #233), so could be useful to consider this somewhat generically. Thoughts on all of this? |
2a8f2ff
to
9993493
Compare
This implementation works but the JSON string w/ |
738ab15
to
f024212
Compare
58906c8
to
4576bd5
Compare
@pirate Is this looking good otherwise? Not 100% sure how I feel about the |
Yeah this looks great so far. We have quite a lot of things to merge in this release, so it may take me a while to get around to merging and testing this fully. Thanks for the work so far and your patience though. @cdvv7788 is also working on refactoring the config system to be more modular / easy to extend, so we may do a cleanup pass of all the config in general soon after we merge this. |
@pirate Awesome, good to know, thanks. I've got a few other ideas & things I'm going to send your way as well, feel free to review/merge them as you have the time, and I'll pull them together in a branch in my fork until they get upstreamed. |
The config system looks promising...I will upload something tomorrow to test the |
5db193e
to
460ba62
Compare
@pirate Fixed everything & ready for re-review. |
4bbefb7
to
0ec9ecc
Compare
0ec9ecc
to
693bffe
Compare
sorry for the rebase but I had to point this to the v0.5.0 draft branch instead of master, do you mind fixing the conflicts and then I'll merge it both files get overwitten automatically by the pip build, so you can resolve the diff however you want and it wont matter. |
@pirate Happy to update it but wondering if we need to wait for the config changes cuz the config file might have to change with the new parser to handle the API key dict. |
Nah don't worry about it we'll change it when we merge that PR. |
Pass a url like `pocket://Username` to import that username's archived Pocket library. Tokens need to be stored in ArchveBox.conf with the following keys: ``` POCKET_CONSUMER_KEY = key-from-custom-pocket-app POCKET_ACCESS_TOKENS = {"YourUsername": "pocket-token-for-app"} ``` `POCKET_ACCESS_TOKENS` MUST be on a single line, or the JSON will be misinterpreted by the parser as a new key/value pair.
693bffe
to
ac7ad9e
Compare
@pirate ok cool updated. |
@pirate Did you delete your comment? If the pocket lib is an issue, I can refactor to use requests directly. The lib isn't so extensive. |
Yeah because I already fixed it by vendoring the lib. iIt's only a single file so it's fine, I was only worried about vendoring if it was a big complicated Python lib. |
Sorry to resurect this - but I couldn't find any documentation on setting up Pocket API other than this PR and #726 I obbtained my keys and I can use the API using CURL so I'm fairly confident I have correct key and token. Running archivebox config config --set POCKET_CONSUMER_KEY=aaaaaa-0123455.... was straightforward but no matter of quoting and escaping allowed me to run I tried manually editing ArchiveBox.conf but I don't think I nailed the syntax, running archivebox add --parser pocket_api pocket://MyUserName
0.4% (1/240sec)
[X] No links found using Pocket API parser
Hint: Try a different parser or double check the input? My ArchiveBox.conf looks like this: bash-3.2# grep POCKET ArchiveBox.conf
POCKET_CONSUMER_KEY = 123456-xxxxxxxxxxxxxxxxx
POCKET_ACCESS_TOKENS = {"myusername":"12345678-aa00-aa00-aa00-aa0000"} Thanks! |
@filviu Main thing that jumps out to me is |
Thank you but it's not this, my example was unfortunate, I'm using the proper username in both places (no uppercase at all). |
Pass a url like
pocket://Username
to import that username's archived Pocketlibrary. Tokens need to be stored in ArchveBox.conf with the following keys:
POCKET_ACCESS_TOKENS
MUST be on a single line, or the JSON will bemisinterpreted by the parser as a new key/value pair.
Summary
I'm not 100% this is the implementation, but my experience w/ the API is it's more
reliable & complete than the feed export. It would be nice to use this as a feed source
but the last
since
value would need to be persisted somewhere.Related issues
None, I wrote this to import my Pocket library locally and was wondering if this would be useful.
Changes these areas