1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| procedure TForm1.Button6Click(Sender: TObject);
const
Chaine1 = '{"artist": "Alain Morisod & Sweet People", "filesize": null, "extractor": "youtube", "vcodec": "none", "height": null, "_filename": "Audio\\Halleluia.webm", "duration": 235, "average_rating": 4.8823528, ';
Chaine2 = '"dislike_count": 1, "is_live": null, "webpage_url_basename": "watch", "format_note": "DASH audio", "channel_url": "http://www.youtube.com/channel/UCuix9xiVI87oi4WtZTSkUCg", "track": "Alleluia", ';
Chaine3 = '"thumbnail": "https://i.ytimg.com/vi/VaDjAsQG6Ao/maxresdefault.jpg", "language": null, "tbr": 140.55, "title": "Alain Morisod & Sweet People = Alleluia", "abr": 160, "series": null, "release_year": null, ';
Chaine4 = '"view_count": 2956, "fps": null, "album": "Super Sympa", "uploader_id": "UCuix9xiVI87oi4WtZTSkUCg", "container": "webm_dash", "protocol": "http_dash_segments", "season_number": null, "annotations": null, ';
Chaine5 = '"age_limit": 0, "format": "251 - audio only (DASH audio)", "fragments": [{"path": "range/0-258"}, {"duration": 10.001, "path": "range/664-174453"}, {"duration": 10.0, "path": ';
Motif = '"title": "';
function ExtraitTitre(aPattern, aFrom: string): string;
var
S: string;
i, Len, LongP: integer;
begin
Result := '';
Len := Length(aFrom);
LongP := Length(aPattern);
i := Pos(Motif, aFrom);
if i = 0 then
Exit
else
S := Copy(aFrom, i+LongP+1, Len-i-LongP+1);
i := Pos('"', S);
if i = 0 then
Exit
else
SetLength(S, i-1);
Result := S;
end;
var
TestString: string;
begin
TestString := Chaine1 + Chaine2 + Chaine3 + Chaine4 + Chaine5;
ShowMessage(ExtraitTitre(Motif, TestString));
end; |
Partager