harness: keep /<user>/ prefix in normalized x.com URLs — dropping the screen name made yt-dlp reject the retry
This commit is contained in:
1 parent
cc0a566978
commit
a7f1f5f6ff
1 file changed
+4
-1
@@ -470,7 +470,10 @@ fn normalizeXUrl(alloc: std.mem.Allocator, url: []const u8) ?[]u8 {
|
|||||||
var id_len: usize = 0;
|
var id_len: usize = 0;
|
||||||
while (id_len < rest.len and std.ascii.isDigit(rest[id_len])) id_len += 1;
|
while (id_len < rest.len and std.ascii.isDigit(rest[id_len])) id_len += 1;
|
||||||
if (id_len == 0) return null;
|
if (id_len == 0) return null;
|
||||||
const bare = std.fmt.allocPrint(alloc, "https://{s}/status/{s}", .{ host, rest[0..id_len] }) catch return null;
|
// Keep the full prefix (e.g. "/<user>/status/") — dropping the screen
|
||||||
|
// name yields "x.com/status/<id>", which yt-dlp rejects as unsupported.
|
||||||
|
const prefix_len = status_idx + marker.len + id_len;
|
||||||
|
const bare = std.fmt.allocPrint(alloc, "https://{s}{s}", .{ host, path[0..prefix_len] }) catch return null;
|
||||||
if (std.mem.eql(u8, bare, url)) {
|
if (std.mem.eql(u8, bare, url)) {
|
||||||
alloc.free(bare);
|
alloc.free(bare);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in new issue
Block a user