TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
To Play Maan
NA
1
581
Programmatically get amount of facebook likes for a specific
Aug 4 2016 9:57 AM
<ol style="color: #acacac; 0px 0px 0px 55px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace, serif; font-size: 12px; 24px; background: #f7f7f7;"><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; ">Programmatically <span style="color: #0600ff; font-weight: bold;">get</span> amount of facebook likes <span style="color: #0600ff; font-weight: bold;">for</span> a specific page</div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; ">I<span style="color: #666666;">'m building a website in ASP.net/C# and currently I want to get the amount of Facebook likes of a specific page (think of a video/article). I need this value programmatically, because I want to sort on it later, but that'</span>s a different story<span style="color: #008000;">.</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "><span style="color: #0000ff;">I</span> already know the link Facebook itself provides to <span style="color: #0600ff; font-weight: bold;">get</span> <span style="color: #0600ff; font-weight: bold;">this</span> amount, which <span style="color: #008000;">is</span> posted below<span style="color: #008000;">.</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "><span style="color: #0000ff;">http</span><span style="color: #0000ff;">:</span><span style="color: #0000ff; font-style: italic;">//past.is/awujl</span></div></li><li style="-webkit-user-select: none; color: #ff0000; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; ">With www<span style="color: #008000;">.</span><span style="color: #0000ff;">google</span><span style="color: #008000;">.</span><span style="color: #0000ff;">com</span> being the website, whose links are being counted and can of course be changed to whichever page one needs<span style="color: #008000;">.</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "><span style="color: #0000ff;">Does</span> anybody know how I can access the xml file, of the URL<span style="color: #008000;">/</span>XML file posted above<span style="color: #008000;">?</span> I<span style="color: #666666;">'ve done some research, but I can'</span>t seem to find an answer that works <span style="color: #0600ff; font-weight: bold;">for</span> me<span style="color: #008000;">.</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "><span style="color: #0000ff;">EDIT</span><span style="color: #008000;">:</span> I found the answer<span style="color: #008000;">.</span> <span style="color: #0000ff;">I</span> had to navigate through the XML a bit and modify the actual URL used<span style="color: #008000;">.</span> <span style="color: #0000ff;">Working</span> code <span style="color: #008000;">is</span> posted below<span style="color: #008000;">.</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "><span style="color: #6666cc; font-weight: bold;">string</span> result<span style="color: #008000;">;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> <span style="color: #6666cc; font-weight: bold;">string</span> urlToXMLfile, currentURL<span style="color: #008000;">;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> currentURL <span style="color: #008000;">=</span> Globals<span style="color: #008000;">.</span><span style="color: #0000ff;">NavigateURL</span><span style="color: #008000;">(</span>TabId, <span style="color: #666666;">""</span>, <span style="color: #666666;">"CategoryId="</span> <span style="color: #008000;">+</span> catId, <span style="color: #666666;">"MovieId="</span> <span style="color: #008000;">+</span> Request<span style="color: #008000;">.</span><span style="color: #0000ff;">QueryString</span><span style="color: #008000;">[</span><span style="color: #666666;">"MovieId"</span><span style="color: #008000;">]</span><span style="color: #008000;">)</span><span style="color: #008000;">;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> urlToXMLfile <span style="color: #008000;">=</span> <span style="color: #666666;">"https://api.facebook.com/method/fql.query?query=select%20%20like_count%20from%20link_stat%20where%20url=%22"</span><span style="color: #008000;">;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> urlToXMLfile <span style="color: #008000;">+=</span> currentURL<span style="color: #008000;">;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> urlToXMLfile <span style="color: #008000;">+=</span> <span style="color: #666666;">"%22"</span><span style="color: #008000;">;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> <span style="color: #008080; font-style: italic;">//XDocument xdoc = XDocument.Load(urlToXMLfile);</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> <span style="color: #008080; font-style: italic;">//string test = xdoc.Descendants(XName.Get("like_count")).First().Value;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> XmlDocument doc <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> XmlDocument<span style="color: #008000;">(</span><span style="color: #008000;">)</span><span style="color: #008000;">;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> doc<span style="color: #008000;">.</span><span style="color: #0000ff;">Load</span><span style="color: #008000;">(</span>urlToXMLfile<span style="color: #008000;">)</span><span style="color: #008000;">;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> result <span style="color: #008000;">=</span> doc<span style="color: #008000;">.</span><span style="color: #0000ff;">FirstChild</span><span style="color: #008000;">.</span><span style="color: #0000ff;">NextSibling</span><span style="color: #008000;">.</span><span style="color: #0000ff;">InnerText</span><span style="color: #008000;">;</span></div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; initial; "> </div></li><li style="-webkit-user-select: none; background: #ffffff;"><div style="-webkit-user-select: text; 0px 8px; vertical-align: top; color: #333333; border-left- 1px; border-left-style: solid; #dddddd; relative; background: #f8f8f8;"> <span style="color: #0600ff; font-weight: bold;">return</span> result<span style="color: #008000;">;</span></div></li></ol>
Reply
Answers (
0
)
How to split the time in asp.net using c#
Crystal Report Error exporting records in Excel format.