c# 微软小冰-虚拟女友聊天
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks; namespace TestXiaobingChat
{
public class HttpHelper
{ public static string Cookie = Properties.Resources.cookie ;
public static string HttpPost(string Url, string postDataStr,bool jsonPost=false )
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
request.Method = "POST";
// request.ContentType = "application/x-www-form-urlencoded";
//application/json;charset=UTF-8
request.ContentType = "application/x-www-form-urlencoded";
if (jsonPost)
{
request.ContentType = "application/json";
}
byte[] postData = Encoding.UTF8.GetBytes(postDataStr);
request.ContentLength = postData.Length;
request.Referer = "https://ux-plus-bing.xiaoice.com/BingVirtualGF?authcode=51E6AE30F8FABC23FAF64F73A102BC9F";
// request.CookieContainer = cc;
request.Headers.Add("cookie",Cookie);
Stream myRequestStream = request.GetRequestStream();
myRequestStream.Write(postData, 0, postData.Length);
myRequestStream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // response.Cookies = cookie.GetCookies(response.ResponseUri);
Stream myResponseStream = response.GetResponseStream();
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8);
string retString = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close(); return retString;
} public static string HttpGet(string Url)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
request.Method = "GET";
request.ContentType = "text/html;charset=UTF-8";
request.Headers.Add("cookie", Cookie);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream myResponseStream = response.GetResponseStream();
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
string retString = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close(); return retString;
} } }
private void Button_Click(object sender, RoutedEventArgs e)
{ HttpHelper.HttpPost("https://ux-plus-bing.xiaoice.com/s_api/game/getresponse?workflow=AIBeingsBingGFChat", Properties.Resources.para ,true ); }
para= {"TraceId":"15ee7bcc2310cefe2ef196df9599f44ad","PartnerName":"bingaibeings","SubPartnerId":"virtualgf","Content":{"Text":"在干嘛","Metadata":{}}}
c# 微软小冰-虚拟女友聊天的更多相关文章
- Hexo之我的桌角女友的食用方式
秀秀 通过使用一个名为 hexo-helper-live2d 的开源库,可以轻松的在自己的Hexo网站下贴上一只生猛可爱的萌妹子或主子: 什么是live2d Live2d是11区宅男们开发出的虚拟女友 ...
- IM即时通讯:如何跳出传统思维来设计聊天室架构?
因为视频直播业务的大规模扩张,聊天室这种功能在最近几年又火了起来.本篇文章将会重点挑选聊天室这个典型场景,和大家分享一下网易云信在实现这个功能时是如何做架构设计的. 相关推荐阅读几十万人同时在线的直播 ...
- 使用 Visual Studio Online 进行协同开发
Visual Studio Online(原来的 Team Foundation Service),是项目数据在云中的主页.在我们的云基础架构中只需数分钟便可启动并运行,无需安装或配置任何服务器.设置 ...
- JS学习知我见(常用建站代码)
<!doctype html><html><head><meta charset="utf-8"><meta name=&qu ...
- 我的第一个python web开发框架(41)——总结
我的第一个python web开发框架系列博文从17年6.7月份开始写(存了近十章稿留到9月份才开始发布),到今天结束,一年多时间,想想真不容易啊. 整个过程断断续续,中间有段时间由于工作繁忙停了好长 ...
- Stable Diffusion魔法入门
写在前面 本文为资料整合,没有原创内容,方便自己查找和学习, 花费了一晚上把sd安装好,又花了大半天了解sd周边的知识,终于体会到为啥这些生成式AI被称为魔法了,魔法使用前要吟唱类比到AI上不就是那些 ...
- Python练习2-基本聊天程序-虚拟茶会话
基本聊天程序 先来个基本的测试例子: Main.py from asyncore import dispatcher import socket,asyncore PORT = 11223 class ...
- c++实现中介者模式--虚拟聊天室
内容: 在"虚拟聊天室"实例中增加一个新的具体聊天室类和一个新的具体会员类,要求如下: 1. 新的具体聊天室中发送的图片大小不得超过20M. 2. 新的具体聊天室中发送的文字长度不 ...
- 情人节用Python智能聊天机器人的实现|制作一个虚拟恋人
首先项目需要的包 import urllib.request import urllib.parse from tkinter import * import time PS:另外很多人在学习Pyth ...
- Android—简单的仿QQ聊天界面
最近仿照QQ聊天做了一个类似界面,先看下界面组成(画面不太美凑合凑合呗,,,,):
随机推荐
- .NET 9 AOT的突破 - 支持老旧Win7与XP环境
引言 随着技术的不断进步,微软的.NET 框架在每次迭代中都带来了令人惊喜的新特性.在.NET 9 版本中,一个特别引人注目的亮点是 AOT( Ahead-of-Time)支持,它允许开发人员将应用程 ...
- JDBC中数据库的连接与查询
让我们仔细看看是怎么访问数据库的 package sql; import java.sql.Connection; import java.sql.DriverManager; import java ...
- Thinkphp漏洞复现
Thinkphp漏洞复现 环境均为vulhub/thinkphp Thinkphp是一种开源框架.是一个由国人开发的支持windows/Unix/Linux等服务器环境的轻量级PHP开发框架. 很多c ...
- VScode 扩展推荐和配置
VScode 扩展推荐和配置 VSCode Extensions 推荐 Themes Dracula Official 拥有明亮的颜色和舒适的对比度,非常适合长时间编程. Nord 基于北极地区自然色 ...
- FreeRTOS LIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 存在的意义以及高于它的中断不能调用 safe freertos api
This is how I understand it. 我是这样理解的. If we now have 2 tasks and 6 interrupts, among which, and when ...
- 自动化部署之Gitlab+Jenkins+Docker
总结自动发布流程: Gitlab+Jenkins+Docker 一般部署方式: 1.外挂方式: 就是将实际的代码挂载到宿主机上,docker中提供程序运行的环境, 这样的话只需要更新对应的代码就够了 ...
- Tornado框架之项目部署(六)
知识点 supervisor配置与使用 nginx配置 目录: 部署Tornado 1. supervisor 安装 配置 启动 supervisorctl 2. nginx 部署Tornado 为了 ...
- SQL Server数据表模糊查询(like用法)详解
在SQL Server Management Studio (SSMS) 中,进行模糊查询主要是通过使用like操作符来实现的.like操作符用于在where语句中搜索列中具有指定模式的数据.我们在简 ...
- redmine部署,踩坑而过
背景:部门想用个工具来做项目执行进度的管理,为了保证数据私有并且不想花钱,选了redmine. 环境:阿里云服务器,windows server R2企业版 软件版本构成: 官方版本说明http:// ...
- 【报错解决】使用代理后从Github中clone仓库报错
当电脑使用代理后,会造成Github的clone和push等功能无法正常使用 报错内容:Failed to connect to github.com port 443 after ***** ms: ...