id author title date pages extension mime words sentences flesch summary cache txt github-com-3123 twarc/network.py at main · DocNow/twarc · GitHub .html text/html 1212 278 69 twarc/network.py at main · DocNow/twarc · GitHub # build a reply, quote, retweet network from a file of tweets and write it # if you would rather have the network oriented around nodes that are users # ./network.py --users tweets.jsonl network.gexf # if you would rather have the network oriented around nodes that are hashtags # instead of tweets or users, use the --hashtags flag from networkx.readwrite import json_graph usage = "network.py tweets.jsonl graph.html" def add(from_user, from_id, to_user, to_id, type, created_at=None): G.add_node(to_user, screen_name=to_user, start_date=created_at) G.add_node(to_user, screen_name=to_user, start_date=created_at) G.add_node(from_id, screen_name=from_user, type=type) G.add_node(to_id, screen_name=to_user) add(from_user, from_id, u['screen_name'], None, 'reply', created_at_date) to_user = t['quoted_status']['user']['screen_name'] to_user = t['retweeted_status']['user']['screen_name'] to_user_id = t['retweeted_status']['user']['id_str'] add(from_user, from_id, to_user, to_id, "retweet") .force("link", d3.forceLink().id(function(d) { return d.id; })) var node = svg.append("g") .attr("class", function(d) { return d.type; }) .attr("class", function(d) { return d.type; }) .attr("y1", function(d) { return d.source.y; }) .attr("y1", function(d) { return d.source.y; }) .attr("cy", function(d) { return d.y; }); ./cache/github-com-3123.html ./txt/github-com-3123.txt