I have an application I'm writing, in Objective-C(iPhone), and I want to be able to write a string of text to Pastie or Pastebin, and be able to have the link to that page. I have not been able to find any API for either of these, is this possible? How?
Thanks!
You will have to construct a HTTP POST request with the fields as described in the <form> tag on the html page.
for pastebin.com it would probably be parent_pid, format, code2 and poster.
Just make sure that the owner of the site doesn't have any problems with your program accessing it this way.
This is their API for pastebin.com: http://pastebin.com/api
Related
I am trying to insert a mention in a confluence page through the REST API.
I tried placing the [~xxxx] in the middle of the content but it doesn't seem to work. When I open the page I see [~xxxx] instead of a link to the mentioned user.
I placed that string in the body>storage>value
I have tried also with <ri:user ri:userkey="xxuserkeyxxx"/> but, in this case, I do not see anything on the page.
Any ideas?
Thanks a lot.
Found the reason why wasn't working, it needs to be:
<ac:link><ri:user ri:userkey="xxuserkeyxxx"/></ac:link>
I was missing the ac:link tag. After adding it, works fine. I wasn't able to find it on the official doc: https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html
You need to use a link with the content being the user's user key
<ac:link><ri:user ri:userkey="f081435773s808c3014357744847024c" /></ac:link>
If you ever need to figure out the correct syntax for storage format:
edit a page and, in this case, #mention someone
go to the "..." menu and View Storage Format to see the result.
ri:userkey is deprecated. Instead use account-id.
<ac:link><ri:user ri:account-id=<accountId> /></ac:link>
I want to set up a login page in which from anywhere on the site I can send a user to it and it will display a custom message along with it. I could use a redirect and a msg query param but is this the best way to do it?
I'm working with node.js but I'm interested in a universal solution.
If you are going for easy, you can just have GET data in the URL. But, that doesn't look that nice, if you want a rather long message, plus, GET has size restrictions, where POST (virtually) hasn't.
For using post data you could use the solution of this: JavaScript post request like a form submit question, but that gives a rather messy source code (if you want a somewhat longer text).
You could keep them in a database, and only send the ID of the message to a PHP page, and get it from the database (that's what I would do, but that doesn't mean it's a good idea, just amateur here!)
You can use jQuery or simply plain javascript to extract your message from the url; the relevant question that listed links to detailed code: jquery get querystring from URL.
Then depending on how you want it displayed, apply the extracted string to your situation.
I'm seeking a lib that takes a URL and returns back useful information like:
Title
Description
List of images
Anything around?
Embed has a nice api for exactly this purpose. link
Try out the REST API links.preview method - https://developers.facebook.com/docs/reference/rest/links.preview/
You can also test out a few URLs to see if this is what you are looking for.
This one made my day: http://www.embedify.me/
Yes. You can send ajax request to a php file which gets contents of the url using file_get_contents() function and returns it to ajax. Then we can extract whatever we want from this data response.
For explanation, live demo and script download follow herehttp://www.voidtricks.com/extracting-url-data-like-facebook/
I'm looking for a solution to "linkify" (twitters term, not mine) tweets - to ensure that #names are correctly linked, at that html links are ready for use too prior to displaying the tweet in a uiwebview
I can see a couple of potential routes
NSScanner based solution where I look for an # and then the next " " and link everything between. Do same for http://
Use Twitter Anywhere linkifier in a UIWebView, which just feels wrong
Some clever regex
So before I reinvent any wheels, has anyone got any advice, done this, know of a prewritten class, or anything else I've forgotten?
Check out this page from the twitter documentation:
http://dev.twitter.com/pages/tweet_entities
Are you using the API? I believe there's now an entities payload on each tweet that identifies where things like URLs, hashtags and usernames are within the text of a tweet.
I'd verify that's there myself, but I'm on a locked down corporate network at the moment.
Edit:
Here's a link to their announcement of the functionality - http://groups.google.com/group/twitter-api-announce/browse_thread/thread/9b869a9fe4d4252e?hl=en#
When you share something on Facebook or Digg, it generates some summary of the page. How would I do this in Perl? What algorithms are there?
For example:
If I go to Facebook and tried to share this question as a link:
How can I create a website summary with Perl?
It retrieves "Facebook/Digg get website summary? - Stack Overflow" as the title (which is just the title of the page) and [... incomplete question?]
CPAN is your friend.
Some promising looking modules:
HTML::Summary
HTML::SummaryBasic
Lingua::EN::Summarize
Assuming you mean sharing a link...
Usually the summary is written by the user submitting the URL. If you have to write a summary automagically this can be achieved by:
Using the first 100 or so characters of the document body (in itself not easy)
Using metadata like the description or keywords (often empty or spammed)
Context-relevant summaries like recreating Google snippets (sorry its PHP but simple)
Tags/keywords from the document using something like the Yahoo Keyword Extractor API or your own keyword density function
Your best bet is to ask the user!
Hope that helps somewhat :)
Basically you want to scrape the URL and find the "most significant paragraph" which might be the first <div> or <p> element after the first <h2> or <h1>, depending on the layout of the page.
You could check and see if there is a meta description on the page, but that leaves you at the mercy of whoever wrote the meta description.