From 081a30e676362454a1e1fbae45fd6f8dbe5a44b3 Mon Sep 17 00:00:00 2001 From: zw963 Date: Sat, 17 Jun 2023 12:57:57 +0000 Subject: [PATCH] deploy: b91a170e0dcdcc1861226b1ed1c229aa40a8ccb1 --- 404.html | 11 +-- Myip.html | 150 ++++++++++++++++++++++++++++-- index.html | 11 +-- index.json | 2 +- search-index.js | 2 +- toplevel.html | 237 ------------------------------------------------ 6 files changed, 148 insertions(+), 265 deletions(-) delete mode 100644 toplevel.html diff --git a/404.html b/404.html index 3fcb1e1..ca6aeeb 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@ - + @@ -13,7 +13,7 @@ - myip 0.4.4 + myip 0.4.5 @@ -39,7 +39,7 @@

- 0.4.4 + 0.4.5 @@ -51,11 +51,6 @@

    -
  • - Top Level Namespace - -
  • -
  • Myip diff --git a/Myip.html b/Myip.html index 2867ccd..045b571 100644 --- a/Myip.html +++ b/Myip.html @@ -4,7 +4,7 @@ - + @@ -13,7 +13,7 @@ - Myip - myip 0.4.4 + Myip - myip 0.4.5 @@ -39,7 +39,7 @@

    - 0.4.4 + 0.4.5
@@ -51,11 +51,6 @@

@@ -51,11 +51,6 @@

    -
  • - Top Level Namespace - -
  • -
  • Myip diff --git a/index.json b/index.json index bf9f764..452133e 100644 --- a/index.json +++ b/index.json @@ -1 +1 @@ -{"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http:/www.ip111.cn 以及 http://www.ip138.com 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \nip111.cn:从国内测试:123.123.123.123 中国 北京市\nip138.com:您的iP地址是:[123.123.123.123 ] 来自:中国北京市西城区 联通\nip111.cn:从国外测试:111.111.111.111 美国 洛杉矶\nip111.cn:从谷歌测试:111.111.111.111 美国 洛杉矶\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"class_methods":[{"html_id":"from_url(url:String,follow:Bool=false):Lexbor::Parser-class-method","name":"from_url","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"args_string":"(url : String, follow : Bool = false) : Lexbor::Parser","args_html":"(url : String, follow : Bool = false) : Lexbor::Parser","location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L9"},"def":{"name":"from_url","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"return_type":"Lexbor::Parser","visibility":"Public","body":"begin\n response = HTTP::Client.get(url)\n if response.status_code == 200\n Lexbor::Parser.new(response.body)\n else\n if follow && (response.status_code == 301)\n from_url(response.headers[\"Location\"], follow: true)\n else\n raise(ArgumentError.new(\"Host returned #{response.status_code}\"))\n end\n end\nrescue Socket::Error\n raise(Socket::Error.new(\"Host #{url} cannot be fetched\"))\nend"}},{"html_id":"get_ip_from_ib_sb(chan)-class-method","name":"get_ip_from_ib_sb","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":22,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L22"},"def":{"name":"get_ip_from_ib_sb","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:\", io.gets_to_end})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}},{"html_id":"get_ip_from_ip111(chan)-class-method","name":"get_ip_from_ip111","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":58,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L58"},"def":{"name":"get_ip_from_ip111","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"begin\n ip111_url = \"http://www.ip111.cn\"\n doc = from_url(ip111_url, follow: true)\n iframe = (doc.nodes(\"iframe\")).map do |node|\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n ip = (from_url(url)).body!.tag_text.strip\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n chan.send({\"ip111.cn:#{title}:\", ip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\n end\n end\n {doc, iframe.size}\nrescue Socket::Error\n STDERR.puts(\"visit #{ip111_url} failed, please check internet connection.\")\n exit\nrescue ArgumentError\n STDERR.puts(\"#{ip111_url} return 500\")\n exit\nrescue ex\n STDERR.puts(ex.message)\n exit\nend"}},{"html_id":"get_ip_from_ip138(chan)-class-method","name":"get_ip_from_ip138","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":40,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L40"},"def":{"name":"get_ip_from_ip138","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}}],"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"module","full_name":"Myip","name":"Myip","abstract":false,"locations":[{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}]}]}} \ No newline at end of file +{"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http:/www.ip111.cn 以及 http://www.ip138.com 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \nip111.cn:从国内测试:123.123.123.123 中国 北京市\nip138.com:您的iP地址是:[123.123.123.123 ] 来自:中国北京市西城区 联通\nip111.cn:从国外测试:111.111.111.111 美国 洛杉矶\nip111.cn:从谷歌测试:111.111.111.111 美国 洛杉矶\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"class","full_name":"Myip","name":"Myip","abstract":false,"superclass":{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"myip/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/myip.cr","line_number":7,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L7"},{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}],"instance_methods":[{"html_id":"from_url(url:String,follow:Bool=false):Lexbor::Parser-instance-method","name":"from_url","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"args_string":"(url : String, follow : Bool = false) : Lexbor::Parser","args_html":"(url : String, follow : Bool = false) : Lexbor::Parser","location":{"filename":"src/myip.cr","line_number":8,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L8"},"def":{"name":"from_url","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"return_type":"Lexbor::Parser","visibility":"Public","body":"begin\n response = HTTP::Client.get(url)\n if response.status_code == 200\n Lexbor::Parser.new(response.body)\n else\n if follow && (response.status_code == 301)\n from_url(response.headers[\"Location\"], follow: true)\n else\n raise(ArgumentError.new(\"Host returned #{response.status_code}\"))\n end\n end\nrescue Socket::Error\n raise(Socket::Error.new(\"Host #{url} cannot be fetched\"))\nend"}},{"html_id":"get_ip_from_ib_sb(chan)-instance-method","name":"get_ip_from_ib_sb","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":21,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L21"},"def":{"name":"get_ip_from_ib_sb","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:\", io.gets_to_end})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}},{"html_id":"get_ip_from_ip111(chan)-instance-method","name":"get_ip_from_ip111","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":57,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L57"},"def":{"name":"get_ip_from_ip111","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"begin\n ip111_url = \"http://www.ip111.cn\"\n doc = from_url(ip111_url, follow: true)\n iframe = (doc.nodes(\"iframe\")).map do |node|\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n ip = (from_url(url)).body!.tag_text.strip\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n chan.send({\"ip111.cn:#{title}:\", ip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n chan.close\n rescue ex\n STDERR.puts(ex.message)\n end\n end\n end\n {doc, iframe.size}\nrescue Socket::Error\n STDERR.puts(\"visit #{ip111_url} failed, please check internet connection.\")\n exit\nrescue ArgumentError\n STDERR.puts(\"#{ip111_url} return 500\")\n exit\nrescue ex\n STDERR.puts(ex.message)\n exit\nend"}},{"html_id":"get_ip_from_ip138(chan)-instance-method","name":"get_ip_from_ip138","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":39,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L39"},"def":{"name":"get_ip_from_ip138","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}}]}]}} \ No newline at end of file diff --git a/search-index.js b/search-index.js index f423b34..2c912e2 100644 --- a/search-index.js +++ b/search-index.js @@ -1 +1 @@ -crystal_doc_search_index_callback({"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http:/www.ip111.cn 以及 http://www.ip138.com 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \nip111.cn:从国内测试:123.123.123.123 中国 北京市\nip138.com:您的iP地址是:[123.123.123.123 ] 来自:中国北京市西城区 联通\nip111.cn:从国外测试:111.111.111.111 美国 洛杉矶\nip111.cn:从谷歌测试:111.111.111.111 美国 洛杉矶\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"class_methods":[{"html_id":"from_url(url:String,follow:Bool=false):Lexbor::Parser-class-method","name":"from_url","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"args_string":"(url : String, follow : Bool = false) : Lexbor::Parser","args_html":"(url : String, follow : Bool = false) : Lexbor::Parser","location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L9"},"def":{"name":"from_url","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"return_type":"Lexbor::Parser","visibility":"Public","body":"begin\n response = HTTP::Client.get(url)\n if response.status_code == 200\n Lexbor::Parser.new(response.body)\n else\n if follow && (response.status_code == 301)\n from_url(response.headers[\"Location\"], follow: true)\n else\n raise(ArgumentError.new(\"Host returned #{response.status_code}\"))\n end\n end\nrescue Socket::Error\n raise(Socket::Error.new(\"Host #{url} cannot be fetched\"))\nend"}},{"html_id":"get_ip_from_ib_sb(chan)-class-method","name":"get_ip_from_ib_sb","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":22,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L22"},"def":{"name":"get_ip_from_ib_sb","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:\", io.gets_to_end})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}},{"html_id":"get_ip_from_ip111(chan)-class-method","name":"get_ip_from_ip111","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":58,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L58"},"def":{"name":"get_ip_from_ip111","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"begin\n ip111_url = \"http://www.ip111.cn\"\n doc = from_url(ip111_url, follow: true)\n iframe = (doc.nodes(\"iframe\")).map do |node|\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n ip = (from_url(url)).body!.tag_text.strip\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n chan.send({\"ip111.cn:#{title}:\", ip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\n end\n end\n {doc, iframe.size}\nrescue Socket::Error\n STDERR.puts(\"visit #{ip111_url} failed, please check internet connection.\")\n exit\nrescue ArgumentError\n STDERR.puts(\"#{ip111_url} return 500\")\n exit\nrescue ex\n STDERR.puts(ex.message)\n exit\nend"}},{"html_id":"get_ip_from_ip138(chan)-class-method","name":"get_ip_from_ip138","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":40,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L40"},"def":{"name":"get_ip_from_ip138","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}}],"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"module","full_name":"Myip","name":"Myip","abstract":false,"locations":[{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}]}]}}) \ No newline at end of file +crystal_doc_search_index_callback({"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http:/www.ip111.cn 以及 http://www.ip138.com 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \nip111.cn:从国内测试:123.123.123.123 中国 北京市\nip138.com:您的iP地址是:[123.123.123.123 ] 来自:中国北京市西城区 联通\nip111.cn:从国外测试:111.111.111.111 美国 洛杉矶\nip111.cn:从谷歌测试:111.111.111.111 美国 洛杉矶\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"class","full_name":"Myip","name":"Myip","abstract":false,"superclass":{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"myip/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/myip.cr","line_number":7,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L7"},{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}],"instance_methods":[{"html_id":"from_url(url:String,follow:Bool=false):Lexbor::Parser-instance-method","name":"from_url","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"args_string":"(url : String, follow : Bool = false) : Lexbor::Parser","args_html":"(url : String, follow : Bool = false) : Lexbor::Parser","location":{"filename":"src/myip.cr","line_number":8,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L8"},"def":{"name":"from_url","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"return_type":"Lexbor::Parser","visibility":"Public","body":"begin\n response = HTTP::Client.get(url)\n if response.status_code == 200\n Lexbor::Parser.new(response.body)\n else\n if follow && (response.status_code == 301)\n from_url(response.headers[\"Location\"], follow: true)\n else\n raise(ArgumentError.new(\"Host returned #{response.status_code}\"))\n end\n end\nrescue Socket::Error\n raise(Socket::Error.new(\"Host #{url} cannot be fetched\"))\nend"}},{"html_id":"get_ip_from_ib_sb(chan)-instance-method","name":"get_ip_from_ib_sb","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":21,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L21"},"def":{"name":"get_ip_from_ib_sb","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:\", io.gets_to_end})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}},{"html_id":"get_ip_from_ip111(chan)-instance-method","name":"get_ip_from_ip111","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":57,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L57"},"def":{"name":"get_ip_from_ip111","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"begin\n ip111_url = \"http://www.ip111.cn\"\n doc = from_url(ip111_url, follow: true)\n iframe = (doc.nodes(\"iframe\")).map do |node|\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n ip = (from_url(url)).body!.tag_text.strip\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n chan.send({\"ip111.cn:#{title}:\", ip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n chan.close\n rescue ex\n STDERR.puts(ex.message)\n end\n end\n end\n {doc, iframe.size}\nrescue Socket::Error\n STDERR.puts(\"visit #{ip111_url} failed, please check internet connection.\")\n exit\nrescue ArgumentError\n STDERR.puts(\"#{ip111_url} return 500\")\n exit\nrescue ex\n STDERR.puts(ex.message)\n exit\nend"}},{"html_id":"get_ip_from_ip138(chan)-instance-method","name":"get_ip_from_ip138","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":39,"url":"https://github.com/crystal-china/myip/blob/v0.4.5/src/myip.cr#L39"},"def":{"name":"get_ip_from_ip138","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}}]}]}}) \ No newline at end of file diff --git a/toplevel.html b/toplevel.html deleted file mode 100644 index 5e388c0..0000000 --- a/toplevel.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - Top Level Namespace - myip 0.4.4 - - - - - - - - -
    -

    - - Top Level Namespace - -

    - - - - - - - - - - - - - - - - - - -

    - - - - Defined in: -

    - - - - - - - - -

    - - - - Method Summary -

    - - - - - - - - -
    - -
    - - - - -

    - - - - Method Detail -

    - -
    -
    - - def from_url(url : String, follow : Bool = false) : Lexbor::Parser - - # -
    - -
    -
    - - [View source] - -
    -
    - -
    -
    - - def get_ip_from_ib_sb(chan) - - # -
    - -
    -
    - - [View source] - -
    -
    - -
    -
    - - def get_ip_from_ip111(chan) - - # -
    - -
    -
    - - [View source] - -
    -
    - -
    -
    - - def get_ip_from_ip138(chan) - - # -
    - -
    -
    - - [View source] - -
    -
    - - - - - - - -
    - - -