RPA/C#
[C#, RPA] web Request payload, header 전송에 사용되는 json파일 만들기
테리베리
2022. 9. 26. 11:00
728x90
반응형
/* Header 만들기 */
reqHeader =New Dictionary(of String, String);
reqHeader("User-Agent") = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.33";
reqHeader("Origin") = "https://m.place.naver.com";
reqHeader("Referer") = "https://m.place.naver.com/place/list?query="+키워드+"&level=top";
reqHeader("x-wtm-graphql") = "eyJhcmciOiLqtJHso7zsiqTtgazrprDqs6jtlIQiLCJ0eXBlIjoicGxhY2UiLCJzb3VyY2UiOiJwbGFjZSJ9";
/* Payload 만들기 */
reqPayload = New Dictionary(of String, Object);
reqPayload("operationName") = "getPlacesList";
reqPayload("variables") = reqPayload_variables; // reqPayload_variables은 제이슨안에 딕셔너리가 하나 더 있는 형태
reqPayload("query") = "query getPlacesList($input: PlacesInput, $isNmap: Boolean!, $isBounds: Boolean!) {\n businesses: places(input: $input) {\n total\n items {\n id\n name\n normalizedName\n category\n detailCid {\n c0\n c1\n c2\n c3\n __typename\n }\n categoryCodeList\n dbType\n distance\n roadAddress\n address\n fullAddress\n commonAddress\n bookingUrl\n phone\n virtualPhone\n businessHours\n daysOff\n imageUrl\n imageCount\n x\n y\n poiInfo {\n polyline {\n shapeKey {\n id\n name\n version\n __typename\n }\n boundary {\n minX\n minY\n maxX\n maxY\n __typename\n }\n details {\n totalDistance\n arrivalAddress\n departureAddress\n __typename\n }\n __typename\n }\n polygon {\n shapeKey {\n id\n name\n version\n __typename\n }\n boundary {\n minX\n minY\n maxX\n maxY\n __typename\n }\n __typename\n }\n __typename\n }\n subwayId\n markerId @include(if: $isNmap)\n markerLabel @include(if: $isNmap) {\n text\n style\n stylePreset\n __typename\n }\n imageMarker @include(if: $isNmap) {\n marker\n markerSelected\n __typename\n }\n oilPrice @include(if: $isNmap) {\n gasoline\n diesel\n lpg\n __typename\n }\n isPublicGas\n isDelivery\n isTableOrder\n isPreOrder\n isTakeOut\n isCvsDelivery\n hasBooking\n naverBookingCategory\n bookingDisplayName\n bookingBusinessId\n bookingVisitId\n bookingPickupId\n easyOrder {\n easyOrderId\n easyOrderCid\n businessHours {\n weekday {\n start\n end\n __typename\n }\n weekend {\n start\n end\n __typename\n }\n __typename\n }\n __typename\n }\n baemin {\n businessHours {\n deliveryTime {\n start\n end\n __typename\n }\n closeDate {\n start\n end\n __typename\n }\n temporaryCloseDate {\n start\n end\n __typename\n }\n __typename\n }\n __typename\n }\n yogiyo {\n businessHours {\n actualDeliveryTime {\n start\n end\n __typename\n }\n bizHours {\n start\n end\n __typename\n }\n __typename\n }\n __typename\n }\n isPollingStation\n hasNPay\n talktalkUrl\n visitorReviewCount\n visitorReviewScore\n blogCafeReviewCount\n bookingReviewCount\n streetPanorama {\n id\n pan\n tilt\n lat\n lon\n __typename\n }\n naverBookingHubId\n bookingHubUrl\n bookingHubButtonName\n newOpening\n newBusinessHours {\n status\n description\n dayOff\n dayOffDescription\n __typename\n }\n coupon {\n total\n promotions {\n promotionSeq\n couponSeq\n conditionType\n image {\n url\n __typename\n }\n title\n description\n type\n couponUseType\n __typename\n }\n __typename\n }\n __typename\n }\n optionsForMap @include(if: $isBounds) {\n ...OptionsForMap\n displayCorrectAnswer\n correctAnswerPlaceId\n __typename\n }\n queryString\n siteSort\n __typename\n }\n}\n\nfragment OptionsForMap on OptionsForMap {\n maxZoom\n minZoom\n includeMyLocation\n maxIncludePoiCount\n center\n spotId\n keepMapBounds\n __typename\n}\n";
reqJSON = Newtonsoft.Json.JsonConvert.SerializeObject(reqPayload);
newtonsoft.Json / newtonsoft.Json/Linq 네임스페이스를 써야함.
728x90
반응형