Кто-то написал (умный) фрагмент в ванильном javascript, который выбирает твиттер-виджеты:
/*********************************************************************
#### Twitter Post Fetcher! ####
Coded by Jason Mayes 2013.
www.jasonmayes.com
Please keep this disclaimer with my code if you use it. Thanks. :-)
Got feedback or questions, ask here: http://goo.gl/JinwJ
*********************************************************************/
var twitterFetcher=function(){var d=null;return{fetch:function(a,b){d=b;var c=document.createElement("script");c.type="text/javascript";c.src="http://cdn.syndication.twimg.com/widgets/timelines/"+a+"?&lang=en&callback=twitterFetcher.callback&suppress_response_codes=true&rnd="+Math.random();document.getElementsByTagName("head")[0].appendChild(c)},callback:function(a){var b=document.createElement("div");b.innerHTML=a.body;a=b.getElementsByClassName("e-entry-title");d(a)}}}();
/*
* ### HOW TO USE: ###
* Create an ID:
* Go to www.twitter.com and sign in as normal, go to your settings page.
* Go to "Widgets" on the left hand side.
* Create a new widget for "user timeline". Feel free to check "exclude replies"
* if you dont want replies in results.
* Now go back to settings page, and then go back to widgets page, you should
* see the widget you just created. Click edit.
* Now look at the URL in your web browser, you will see a long number like this:
* 345735908357048478
* Use this as your ID below instead!
*/
twitterFetcher.fetch('345170787868762112', function(tweets){
// Do what you want with your tweets here! For example:
var x = tweets.length;
var n = 0;
var element = document.getElementById('tweets');
var html = '';
while(n < x) {
if (tweets[n].innerText) {
html += '- ' + tweets[n].innerText + '
';
} else {
html += '- ' + tweets[n].textContent + '
';
}
n++;
}
html += '
';
element.innerHTML = html;
});
http://jsfiddle.net/jmayes/maT2Z/
Не самый чистый способ и, возможно, не ориентированный на будущее, но на данный момент единственное (я знаю) решение для доступа к данным в Твиттере без OAuth и поддержки на стороне сервера.
function CopyByteArray(const C: array of Byte): TByteDynArray;
begin
SetLength(Result, Length(C));
Move(C[Low(C)], Result[0], Length(C));
end;
procedure TFormMain.Button1Click(Sender: TObject);
const
C: array[1..10] of Byte = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
var
D: TByteDynArray;
I: Integer;
begin
D := CopyByteArray(C);
for I := Low(D) to High(D) do
OutputDebugString(PChar(Format('%d: %d', [I, D[I]])));
end;
procedure TFormMain.Button2Click(Sender: TObject);
const
C: array[1..10, 1..10] of Byte = (
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
var
D: array of TByteDynArray;
I, J: Integer;
begin
SetLength(D, Length(C));
for I := 0 to Length(D) - 1 do
D[I] := CopyByteArray(C[Low(C) + I]);
for I := Low(D) to High(D) do
for J := Low(D[I]) to High(D[I]) do
OutputDebugString(PChar(Format('%d[%d]: %d', [I, J, D[I][J]])));
end;
Это скопирует constAry1 в dynAry .
SetLength(dynAry, Length(constAry1));
Move(constAry1[Low(constAry1)], dynAry[Low(dynAry)], SizeOf(constAry1));