How to get github edit history of issue and issue comments via api? - api

I only found api to get issue list, issue content, issue comments list and content, no issue content edit history, no issue comments edit history.

No, this cannot currently be done purely from the API.
However, if we reverse engineer the way GitHub loads past edits in the web interface, and do a bit of scraping, we can accomplish the same thing without the API. Unfortunately, this means that we don't have the reliability of an API - GitHub's web interface is liable to change at any time, breaking our code. But it's better than nothing!
So, first we need a log of all the edits for a comment. Let's do this with the comment https://github.com/seisvelas/crypsee/issues/1#issue-874033952 (from a test repo provided by the gentleman who set the bounty on this question). On order to get a log of this issue's comments, we will need to base64 encode the issue number with '05:' then the word 'Issue' at the beginning. Why '05:'? I have no idea. But it's always there and it won't work with out it. So we'll be base64 encoding the string "05:Issue874033952", which gives us MDU6SXNzdWU4NzQwMzM5NTI=
Great, now we insert MDU6SXNzdWU4NzQwMzM5NTI= into this URL scheme: https://github.com/_render_node/{BASE64 ENCODING HERE}/comments/comment_edit_history_log, resulting in a link to https://github.com/_render_node/MDU6SXNzdWU4NzQwMzM5NTI=/comments/comment_edit_history_log
Following that link, we see an edit history, but not the contents of the edits themselves:
However, this gives us the information we need! If we look at the HTML, we see that all edits prior to the current edit are defined as buttons with a link to that edit:
<button
type="button"
class="btn-link dropdown-item p-2"
role="menuitem"
data-edit-history-url="/user_content_edits/MDE1OlVzZXJDb250ZW50RWRpdElzc3VlRWRpdDo1MzIxODcxNzE="
>
The URL pointed to by the data-edit-history-url is the same URL loaded via the browser's networking tab when clicking to view a past edit in the web interface!
Unfortunately, if you attempt to view that page on it's own, you get a 404. It is intended to be viewed only from the web interface. But that's no problem, just go to the web interface, view one of the edits, and copy the headers it sends along. In my case I'm using Chromium, so I just find the request to the edit in my networking tab, right click and hit 'copy as Fetch request (nodejs)' and viola, with those headers I'm good to go!
For example, for the comment we've been using this whole time, I make that request and get back a bunch of HTML. The content of the original edit is near the end:
<ins><p class="rich-diff-level-zero">before edit</p></ins>
There it is! I could write a script to automate this, but then I'd be doing everything for you :3 Suffice it to say that with a day's work of cleverly organized scraping, this is roughly what you must to in order to view these revisions. If someone does make such a tool, the OSINT community will surely be immensely grateful!

To see the features of github api, it is better to read the following link
The best source to get the answer:
https://docs.github.com/en/rest/reference/issues
Check the issues you mentioned, ie issue comments, edit history issue, etc. in the link above
As far as I saw it is possible to receive issue comments but I did not see a section for edit history issue
I also suggest you see the following links for the edit history issue:
https://github.com/isaacs/github/issues/954

Related

Downloading a CSV file, secured by authorization, with a click on a button

I'm trying to get Excel to download a CSV file, from a link that changes by the day, with a click on a button. The thing is, it's locked behind an agreement-number, ID and password.
I, however, got two API tokens:
TheAppSecretToken
TheAgreementGrantToken
The link is:
https://secure.e-conomic.com/secure/generelt/exportdata2.asp?mode=doexport&kartotek=5&fradato=01-01-2017&tildato=01-02-2018&vcseparator=%3B&vcQualifier=%22
If people have another way, than using a VBA-code, to download this file with a click on a button, don't hold back with the suggestion.
I appreciate any help I can get, thank you. :-)
EDIT: It's not a duplicate for another question, as this uses Tokens, and or 3 login informations.
EDIT2: nvm. that the link is changing from day-to-day, I figured out that I can just put the date as far out in the future, as I like.
Edit:
I assume that the login call needs to be an POST request, but this is only a guess as I can't test it with the information you have given
Just change the loginBody with the information you need or change it to the format that the URL needs (like JSON) and you can send as many information as need
If needed you can also set more headers for any other tokens you have
URL = "YOURURL"
loginBody = "username=username&password=password&token=token"
HttpObj.Open("POST", URL)
HttpObj.SetRequestHeader("Content-Type","application/x-www-form-urlencoded")
HttpObj.Send(loginBody)
Old answer:
As I'm not allowed to comment it seems what you are trying to do is explained here:
How do i download a file using VBA (Without internet explorer)

How to show someone came from a link on my website?

It must be the full url, not just history or type. I have seen, on statcounter.com, where they show stats regarding where the referrer of our site came from. I want to show the exact link like statcounter shows under a tab.
Does anyone know how to do this?
You will want to use Google Analytics.
Google will generate a unique javascript code for you, you then paste it in your html, which activates the service. It's very easy to get started and the dashboard is very robust considering it's free. To get started, you can check this out: http://www.google.com/analytics/learn/setupchecklist.html

What should be located at the homepage of a REST API?

I'm currently in the process of writing a REST API and this question always seems to popup.
I've always just added a description, quick links to docs, server time etc, but see now (after looking around a bit) that a simple redirect to the API docs would be even better.
My question is what would be the accepted norm to have as the root - '/' - "homepage" of your API?
I've been looking at a few implementations:
Facebook: Just gives a error of "Unsupported get request.";
Twitter: Shows an actual 404 page;
StackOverflow: Redirect to quick "usage" page.
After looking at those it's clear everyone is doing it differently.
In the bigger picture this is of little significance but would be interesting to see what the "RESTfull" way of doing it (if there is one) might be.
Others have had the same question and as you discovered yourself everyone is doing it their own way. There is a move in this direction to somehow standardize it, so see if you find this draft useful:
Home Documents for HTTP APIs aka JSON Home.
I've give this much thought and right now I either return a 404 page, a health status page, a dummy page or redirect to another page, mostly likely on within the organization.
An API homepage isn't something everyone should be looking at and believe me, it can be found. There are more people like me that love to inspect the browser and see how a website is performing.

How do I remove a facebook comment warning?

my fb comments code is:
<fb:comments url="<?=$this_url?>" width="600" xid="<?=$this_unique_xid?>" notify="true" candelete="true" simple="1" numposts=1 url="http://www.veethi.com"></fb:comments>
Now if i want to remove the warning message:
Warning: this comments plugin is operating in compatibility mode, but
has no posts yet. Consider specifying an explicit ‘href’ as suggested
in the comments plugin documentation to take advantage of all plugin
features
I need to replace "url" to "href", but by doing this i lose my old comments,
Is anyone who facing the problem or solution pls, reply me.
I need one solution that remove the warning message and the same way i have all my old comments.
thankx in advance.
I wrote a complete tutorial with a small use of JS to solve this issue.
Visit the tutorial
What I did was:
Set off the parse for XFBML tags in the JS SDK
Adding a function-call to the JS SDK with a date parameter that you manually set it once with a date that posts published after that date will start using the 'href' version, and posts published until that date will use the migrated version.
Adding another attribute to the fb:comments tag which is 'data-date' and in it's value you place your post date (dynamic code).
Calculating the dates in a JS code, and base on the result it's removing the not wanted attributes, and finally then it's render the XFBML tags using FB.XFBML.parse
Instead of <fb:comments ..., I used <div class="fb-comments" ... and then everything worked correctly.
https://developers.facebook.com/docs/reference/plugins/comments/
Put your website URL, set the number of posts that you want to have in comments, get the code. First part put it in header, right after <body> and the <div> in single.php (single post template). Delete </div><?php comments_template(); ?></div> and add the one from facebook ;) Works perfect for me ;)
#gil-goldshlager, thanks for this workaround, I think a lot of developers are looking for this. I myself are struggling with this since a long time on one of my sites: sharemovi.es
I think most important thing you managed is to show old vs new comments side by side.
Unfortunately the yellow box still shows up in some instances, and some comments get lost consequently :
OK: post after 12.15.2011 without comments (http://sharemovi.es/theprestige)
OK: both post + comments after 12.15.2011 (http://sharemovi.es/biutiful)
OK: both post + comments before 12.15.2011 (http://sharemovi.es/thesocialnetwork, http://sharemovi.es/battlelosangeles and http://sharemovi.es/thequickandthedead) - really nice to see those comments back!
not OK: posts before 12.15.2011 without comments - 2 problems here:
a. yellow box with "Warning: this comments plugin is operating in compatibility mode, but has no posts yet. Consider specifying an explicit 'href' as suggested in the comments plugin documentation to take advantage of all plugin features."
b. the comments for those posts/pages that were made AFTER 12.15.2011 disappear (without comments: http://sharemovi.es/fromdusktilldawn, http://sharemovi.es/waiting, with comments - I checked moderation panel - http://sharemovi.es/ellesappelaitsarah and http://sharemovi.es/thegame )
All together, I get more comments now than before, so thanks again. However the yellow box is quite ugly, doesn't look professional. Very bad design decision from Facebook!
Hopefully you can look into this, I am happy to assist where possible.
Cheers
Bob

Facebook app to edit posts

Is it possible to make a Facebook app which edits user's post on his wall automatically (edits EVERY POST that user makes, app has user's permission and everything)
I don't think that's possible, but maybe I'm wrong?
Based on the Graph API docs, I actually think it could work.
Get the extended permission called
"offline_access". See
http://developers.facebook.com/docs/authentication/permissions
Periodically pull from
https://graph.facebook.com/PROFILE_ID/feed
to see if the user has posted new
posts.
If so, for each new post that has appeared:
Pull and store the text of the post.
Manipulate the text as desired.
Delete the original post using
"DELETE". See
http://developers.facebook.com/docs/api#deleting
Publish your modified version of the
post using "POST". See
http://developers.facebook.com/docs/api#publishing
#Jon: You cannot delete a post that your application has not published.
See here: https://developers.facebook.com/docs/reference/api/post/
No, it's not possible for security reasons. Even though you probably have the best of intentions, there are lots of people who unfortunately don't. The few ruin it for all.